Skip to content

Instantly share code, notes, and snippets.

@jbarrett
Created September 18, 2012 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbarrett/3743143 to your computer and use it in GitHub Desktop.
Save jbarrett/3743143 to your computer and use it in GitHub Desktop.
Quick DBIx::Class::Schema::Versioned deployment skeleton
#!/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