Test::DBChanges::Pg::DBIC - track changes to DBIC+PostgreSQL resultsets
version 1.0.2
my $dbchanges = Test::DBChanges::Pg::DBIC->new({ schema => $schema, source_names => [qw(Things Ledger)], }); # later: my $changeset = $dbchanges->changeset_for_code(sub { do_something($dbh) }); for my $row ($changeset->changes_for_source('Things')->inserted_rows->@*) { # $row is a MySchema::Result::Things object with the inserted data }
This class installs a set of triggers in the database, that record all changes (insert, update, delete) to a set of tables.
It can then parse this record into a changeset, which will build DBIC objects corresponding to each changed row.
NOTE: the row objects will not be in_storage (some of them may refer to deleted rows, for example!)
in_storage
This should really only be used in tests. At the moment the table, stored procedure and triggers that this class needs are installed but never removed.
source_names
Arrayref of resultset names corresponding to the tables to record changes for.
schema
The connected schema to track changes in.
Gianni Ceccarelli <gianni.ceccarelli@broadbean.com>
This software is copyright (c) 2019 by BroadBean UK, a CareerBuilder Company.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Test::DBChanges, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::DBChanges
CPAN shell
perl -MCPAN -e shell install Test::DBChanges
For more information on module installation, please visit the detailed CPAN module installation guide.