Created
September 18, 2012 13:39
-
-
Save jbarrett/3743143 to your computer and use it in GitHub Desktop.
Quick DBIx::Class::Schema::Versioned deployment skeleton
This file contains 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 | |
use strict; | |
use warnings; | |
use FindBin; | |
use lib "$FindBin::Bin/../lib"; | |
use Foo::Schema; | |
my $sql_dir = "$FindBin::Bin/../sql"; | |
my $schema = Foo::Schema->connect('dbi:SQLite:foo.db'); | |
my $schema_version = $schema->schema_version(); | |
my $db_version = $schema->get_db_version(); | |
$schema->create_ddl_dir( undef, $schema_version, $sql_dir, $db_version ); | |
if ($db_version) { | |
$schema->upgrade(); | |
} | |
else { | |
$schema->deploy(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment