Bug 25511: Add --force option to update_dbix_class_files.pl
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 15 May 2020 09:51:46 +0000 (10:51 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 20 Jul 2020 15:45:31 +0000 (17:45 +0200)
This adds a --force option to the aforementioned script allowing those
in the know to overwrite the schema when changes above the found are
detected.

Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

misc/devel/update_dbix_class_files.pl

index 0c4a88e..ccf5f34 100755 (executable)
@@ -38,6 +38,7 @@ my $db_name;
 my $db_user;
 my $db_passwd;
 my $koha_conf;
+my $force;
 my $help;
 
 GetOptions(
@@ -49,6 +50,7 @@ GetOptions(
     "db_user=s"   => \$db_user,
     "db_passwd=s" => \$db_passwd,
     "koha-conf:s" => \$koha_conf,
+    "force"       => \$force,
     "h|help"      => \$help
 );
 
@@ -95,9 +97,11 @@ if (! defined $db_name ) {
     pod2usage(1);
 } else {
 
+    $force //= 0;
+
     make_schema_at(
         "Koha::Schema",
-        { debug => 1, dump_directory => $path, preserve_case => 1 },
+        { debug => 1, dump_directory => $path, preserve_case => 1, overwrite_modifications => $force },
         [
             "DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",
             $db_user,