Created
December 17, 2013 06:09
-
-
Save sng2c/8000776 to your computer and use it in GitHub Desktop.
DBIC dump schema script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| database: | |
| dsn: DBI:mysql:database=DBNAME;host=DBHOST | |
| userid: DBUSER | |
| passwd: DBPASS | |
| options: | |
| mysql_enable_utf8: 1 | |
| mysql_auto_reconnect: 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| my $base_package = 'MyClass::Schema'; | |
| my $dump_directory = './lib'; | |
| ### use this module to generate a set of class files | |
| use YAML; | |
| my $config = YAML::LoadFile('config.yaml'); | |
| my $db = $config->{database}; | |
| # in a script | |
| use DBIx::Class::Schema::Loader qw/ make_schema_at /; | |
| make_schema_at( | |
| $base_package, | |
| { debug => 1, | |
| dump_directory => $dump_directory, | |
| components => ['InflateColumn::DateTime', 'TimeStamp'], | |
| }, | |
| [ | |
| $db->{dsn}, | |
| $db->{userid}, | |
| $db->{passwd}, | |
| $db->{options}, | |
| ], | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment