Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[livejournal] r17762: Minor changes: forcing --beta check on a...

Committer: gariev
Minor changes: forcing --beta check on alpha/beta/omega servers
U   trunk/bin/upgrading/update-db.pl
Modified: trunk/bin/upgrading/update-db.pl
===================================================================
--- trunk/bin/upgrading/update-db.pl	2010-11-23 13:10:34 UTC (rev 17761)
+++ trunk/bin/upgrading/update-db.pl	2010-11-24 04:35:23 UTC (rev 17762)
@@ -48,13 +48,14 @@
                      these statements to be executed
   -b  --beta         Affects '--populate' option - only data that are safe during
                      update of beta server will be loaded into DB
+      --nobeta       to run in 'production' mode on beta server (don't do it)
 ";
 
 die $usage unless
 GetOptions("runsql"     => \$opt_sql,
            "drop"       => \$opt_drop,
            "populate"   => \$opt_pop,
-           "beta"       => \$opt_beta,
+           "beta!"      => \$opt_beta,
            "confirm=s"  => \$opt_confirm,
            "cluster=s"  => \$cluster,
            "skip=s"     => \$opt_skip,
@@ -71,8 +72,12 @@
 $opt_innodb = 1 if $LJ::USE_INNODB;
 
 die $usage if $opt_help;
-die "You must specify '--populate' option with '--beta'" if $opt_beta && !$opt_pop;
+die "You must specify '--populate' option with '--[no]beta'" 
+    if defined $opt_beta && !$opt_pop;
+die "You are running script on beta server without specifying '--beta' option"
+    if $opt_pop && !defined($opt_beta) && $LJ::IS_LJCOM_BETA;
 
+
 ## make sure $LJHOME is set so we can load & run everything
 unless (-d $ENV{'LJHOME'}) {
     die "LJHOME environment variable is not set, or is not a directory.\n".
@@ -823,7 +828,8 @@
         print "# Running...\n";
         $dbh->do($sql);
         if ($dbh->err) {
-            die "#  ERROR: " . $dbh->errstr . "\n";
+            use Carp;
+            confess "#  ERROR ($sql): " . $dbh->errstr . "\n";
         }
     }
 }

Tags: gariev, livejournal, pl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments