From fe302913e0768044527f060836ffd22c6ab2768f Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Sun, 4 Mar 2018 10:53:35 -0500 Subject: add script to migrate database --- scripts/migrate-database.pl | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 scripts/migrate-database.pl diff --git a/scripts/migrate-database.pl b/scripts/migrate-database.pl new file mode 100755 index 000000000..cde7c80c0 --- /dev/null +++ b/scripts/migrate-database.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl +use 5.10.1; +use strict; +use warnings; + +use File::Basename; +use File::Spec; +BEGIN { + require lib; + my $dir = File::Spec->rel2abs(dirname(__FILE__)); + my $base = File::Spec->catdir($dir, ".."); + lib->import($base, File::Spec->catdir($base, "lib"), File::Spec->catdir($base, qw(local lib perl5))); + chdir $base; +} + +use Bugzilla; +BEGIN { Bugzilla->extensions } + +use Bugzilla::DB; +use Bugzilla::Install::DB; +use Bugzilla::Config qw(update_params); + +Bugzilla::DB::bz_create_database(); + +# Clear all keys from Memcached to ensure we see the correct schema. +Bugzilla->memcached->clear_all(); + +# now get a handle to the database: +my $dbh = Bugzilla->dbh; +# Create the tables, and do any database-specific schema changes. +$dbh->bz_setup_database(); +# Populate the tables that hold the values for the