SQLT-DIFF(1p)
π SQLT-DIFF β find the differences b/w two schemas β¨
okay bestie, welcome to sqlt-diff, a little utility living in the User Contributed Perl Documentation corner of your system. it diffs two schemas and tells you what SQL you'd need to make the first one look like the second. no cap. π¦
πΈ SYNOPSIS πΈ
need help? say less:
sqlt-diff -h|--help
want the whole roster of valid parsers? iconic, here:
sqlt -l|--list
and to actually diff two schemas, the main character move:
sqlt-diff [options] file_name1=parser1 file_name2=parser2
π Options π
-d,--debugβ spills all the debugging info, very nosy of you, love that-t,--traceβ turns on tracing forParse::RecDescent, if you're feeling detective-y-c,--case-insensitiveβ compares tables/columns without caring about case, because we're not gatekeepingUsersvsusers--ignore-index-namesβ pretends index name differences aren't even a thing--ignore-constraint-namesβ same energy, but for constraint names--mysql_parser_version=<#####>β tells it which target MySQL parser version to use when dealing with/*!comments--output-db=<Producer>β use this Producer instead of the one matchingparser1when formatting output for new tables--ignore-view-sqlβ view SQL differences? never heard of her--ignore-proc-sqlβ procedure SQL differences? also not on our radar--no-batch-altersβ stops it from clumping multiple alters on the same table into a singleALTER TABLEstatement where possible--quote=<character>β wraps every table and field name in statements with<character>, cute and consistent π
β¨ DESCRIPTION β¨
so sqlt-diff is the utility that builds you a file of SQL commands, and those commands are the ones you need to transform the first schema into the second one. it's not yet exhaustive in its ability to mutate the entire schema (growth mindset, okay?), but it will report the following:
- New tables
using the Producer class of the target (second) schema, any tables missing from the first schema get generated in their entirety β fields, constraints, indices, the whole fit. π
- Missing/altered fields
any fields missing or altered between the two schemas get reported like this:
ALTER TABLE <table_name>
[DROP <field_name>]
[CHANGE <field_name> <datatype> (<size>)] ;
- Missing/altered indices
any indices that are missing, or are a different type, or sit on different fields get flagged. indices that should be dropped get reported like this:
DROP INDEX <index_name> ON <table_name> ;
and an index of a different type or on different fields gets reported as a brand new index, like this:
CREATE [<index_type>] INDEX [<index_name>] ON <table_name>
( <field_name>[,<field_name>] ) ;
the ALTER, CREATE and DROP statements are all created by SQL::Translator::Producer::* β go peek over there for support and/or problems, fr fr.
heads up: currently (v0.0900), only MySQL is supported by this code. one day the roster will expand, but today? it's MySQL's moment. π
π AUTHOR π
Ken Youens-Clark <kclark@cpan.org>. legend behavior.
π«Ά SEE ALSO π«Ά
SQL::Translator, <http://sqlfairy.sourceforge.net>.
and that's the whole vibe, bestie β brought to you by perl v5.40.0, dated 2024-11-23. go diff something iconic. πβ¨π
π¦ where this page comes from
- debian trixie: libsql-translator-perl 1.66-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libsql-translator-perl 1.66-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libsql-translator-perl 1.66-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms