NAME

DBIO::SQLite::Introspect::Triggers - Introspect SQLite triggers

VERSION

version 0.900007

DESCRIPTION

Fetches the triggers of a database from sqlite_master, each with the statement it was created by.

The model carries them so that an operation that removes a table and puts it back can put its triggers back as well -- SQLite drops a table's triggers with the table, and DBIO::SQLite::Diff::Rebuild is such an operation. They are not compared: "install_ddl" in DBIO::SQLite::DDL has no way to declare a trigger, so the model of a schema never holds one, and a diff that compared them would drop every trigger a database has.

METHODS

fetch

my $triggers = DBIO::SQLite::Introspect::Triggers->fetch($dbh, $tables);

Given the tables hashref produced by DBIO::SQLite::Introspect::Tables, returns a hashref keyed by the name of the table or view a trigger is on -- a view for an INSTEAD OF trigger. Each value is a hashref keyed by trigger name. Each trigger entry has: trigger_name, table_name, sql (the CREATE TRIGGER statement from sqlite_master, without a closing semicolon). A table without triggers has no entry.

table_name, and the key, is the name the table has in $tables. sqlite_master itself holds the name as the trigger's statement spells it: CREATE TRIGGER ... ON item for a table created as Item is listed under item there, and under Item here.

Only sqlite_master is read. A TEMP trigger lives in sqlite_temp_master, belongs to the connection that created it and is not in the model. A trigger on something that is not in $tables -- a shadow table of a virtual table -- is left out with it.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.