summaryrefslogtreecommitdiffstats
path: root/bin/db_deploy
diff options
context:
space:
mode:
Diffstat (limited to 'bin/db_deploy')
-rwxr-xr-xbin/db_deploy31
1 files changed, 31 insertions, 0 deletions
diff --git a/bin/db_deploy b/bin/db_deploy
new file mode 100755
index 0000000..eca393e
--- /dev/null
+++ b/bin/db_deploy
@@ -0,0 +1,31 @@
+#!/usr/bin/env perl
+use v5.20;
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use ASM::Config;
+use ASM::DB;
+use Getopt::Long;
+use DBIx::Class::DeploymentHandler;
+
+GetOptions(
+ 'config|c=s' => \$::cset,
+);
+if ($::cset eq '') { $::cset = 'config-default'; }
+else { $::cset = "config-$::cset"; }
+ASM::Config->readConfig();
+
+my $schema = ASM::DB->connect($::mysql->{dsn}, $::mysql->{user}, $::mysql->{pass});
+
+my $dh = DBIx::Class::DeploymentHandler->new({
+ schema => $schema,
+ schema_version => '' . $schema->schema_version,
+ sql_translator_args => { add_drop_table => 0, quote_identifiers => 1 },
+ databases => [],
+ ignore_ddl => 1,
+ });
+
+$dh->install;