SQL::Translator::Diff(3pm) User Contributed Perl Documentation SQL::Translator::Diff(3pm)

SQL::Translator::Diff - determine differences between two schemas

Takes two input SQL::Translator::Schemas (or SQL files) and produces ALTER statements to make them the same

Simplest usage:

 use SQL::Translator::Diff;
 my $sql = SQL::Translator::Diff::schema_diff($source_schema, 'MySQL', $target_schema, 'MySQL', $options_hash)

OO usage:

 use SQL::Translator::Diff;
 my $diff = SQL::Translator::Diff->new({
   output_db     => 'MySQL',
   source_schema => $source_schema,
   target_schema => $target_schema,
   %$options_hash,
 })->compute_differences->produce_diff_sql;

Match indexes based on types and fields, ignoring name.
Match constrains based on types, fields and tables, ignoring name.
Which producer to use to produce the output.
Ignore case of table, field, index and constraint names when comparing
Produce each alter as a distinct "ALTER TABLE" statement even if the producer supports the ability to do all alters for a table as one statement.
If the diff would need a method that is missing from the producer, just emit a comment showing the method is missing, rather than dieing with an error
Hash of extra arguments passed to "new" in SQL::Translator and the below "PRODUCER FUNCTIONS".

The following producer functions should be implemented for completeness. If any of them are needed for a given diff, but not found, an error will be thrown.

Original Author(s) unknown.

Refactor/re-write and more comprehensive tests by Ash Berlin "ash@cpan.org".

Redevelopment sponsored by Takkle Inc.

2024-01-20 perl v5.38.2