Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jhthorsen/dbix-class-schema-diff
Diff two schemas, regardless of version numbers
https://github.com/jhthorsen/dbix-class-schema-diff
Last synced: 27 days ago
JSON representation
Diff two schemas, regardless of version numbers
- Host: GitHub
- URL: https://github.com/jhthorsen/dbix-class-schema-diff
- Owner: jhthorsen
- Created: 2010-07-08T10:33:51.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2010-07-09T11:40:58.000Z (over 14 years ago)
- Last Synced: 2024-10-16T11:58:42.952Z (3 months ago)
- Language: Perl
- Homepage:
- Size: 121 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: Changes
Awesome Lists containing this project
README
NAME
DBIx::Class::Schema::Diff - Diff two schemas, regardless of version
numbersVERSION
0.00DESCRIPTION
Is there a project which can check out two tags/commits from
git and make a diff between the two schemas? So instead of
having the version information in the database, I would like
to A) make a diff between database and the current checked out
version from the repo B) make a diff between two git-versions.SYNOPSIS
From a module:use DBIx::Class::Schema::Diff;
my $diff = DBIx::Class::Schema::Diff->new(
from => $dsn,
to => 'MyApp::Schema',
databases => ['SQLite'],
);# write "diff", "to" and "from" to disk
$diff->diff_ddl($directory) or die $diff->errstr;
$diff->to_ddl($directory) or die $diff->errstr;
$diff->from_ddl($directory) or die $diff->errstr;Using the script:
$ schema-diff.pl \
--from 'DBI:SQLite:t/db/one.sqlite' \
--to 'dbi:Pg:dbname=somedatabase&user&pass' \
--write-from \
--write-to \
--output - \
;ATTRIBUTES
from
Any source (module name, dbh or dsn) which has the old version of the
schema. This attribute can coerce. See DBIx::Class::Schema::Diff::Types
for details.to
Any source (module name, dbh or dsn) which has the new version of the
schema. This attribute can coerce. See DBIx::Class::Schema::Diff::Types
for details.databases
Which SQL language the output files should be in.errstr
Holds the last error if any as a string.METHODS
diff_ddl
$bool = $self->diff_ddl($directory, \%args);
$bool = $self->diff_ddl(\$text, \%args);Will write the diff (one file per each type in "databases") between
"from" and "to" to a selected $directory. %args is passed on to
SQL::Translator::Diff::new(), but "output_db", "source_schema" and
"target_schema" is set by this method.Will write DDL to $text if given as a scalar reference. (This might not
make much sense, if you have more than one type defined in "databases").from_ddl
to_ddl
$bool = $self->from_ddl($directory);
$bool = $self->from_ddl(\$text);
$bool = $self->to_ddl($directory);
$bool = $self->to_ddl(\$text);Will write "from" or "to" schemas as DDL to the given directory, with
all the languages defined in "databases".Will write DDL to $text if it is given as a scalar reference. (This
might not make much sense, if you have more than one type defined in
"databases".COPYRIGHT & LICENSE
This library is free software. You can redistribute it and/or modify it
under the same terms as Perl itself.AUTHOR
Jan Henning Thorsen "jhthorsen at cpan.org"