summaryrefslogtreecommitdiffstats
path: root/bin/db_upgrade
diff options
context:
space:
mode:
authorLibravatarJanik Kleinhoff <ilbelkyr@shalture.org>2016-10-30 10:11:11 +0000
committerLibravatarJanik Kleinhoff <ilbelkyr@shalture.org>2016-10-30 13:47:22 +0000
commitde9f3deabe35fcc0a09dd4c62b6c626ba4282447 (patch)
tree7820848df3adc72f93427369ef8704a7aae91fc1 /bin/db_upgrade
parent6b8fe391c6c2ea98da7d43593e52c1bcb6ba882f (diff)
Use DBIx::Class::DeploymentHandler
Fixes T5. Yay! We still need some documentation on this, though.
Diffstat (limited to 'bin/db_upgrade')
-rwxr-xr-xbin/db_upgrade31
1 files changed, 31 insertions, 0 deletions
diff --git a/bin/db_upgrade b/bin/db_upgrade
new file mode 100755
index 0000000..fc424ae
--- /dev/null
+++ b/bin/db_upgrade
@@ -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->upgrade;