bin/regen.sh - Drop-create table `zipcodes`
authorTim Otten <totten@civicrm.org>
Mon, 23 May 2016 20:31:07 +0000 (13:31 -0700)
committerTim Otten <totten@civicrm.org>
Mon, 23 May 2016 20:31:07 +0000 (13:31 -0700)
The original `regen.sh` script drops the table `zipcodes` after creating it.
That works fine in normal execution (when `regen.sh` finishes without
erorr).  But if there is an error, then the table gets left in the DB -- and
creates a conflict when you try re-run `regen.sh`.

This patch does a 'drop-create' so that subsequent runs will work despite a
previous error.

bin/regen.sh

index 854bd98aced27429bcf9b8f0f650b0fe64ba822f..8b2a7811305fe4585bbc8e910a07f7e2415597d0 100755 (executable)
@@ -39,6 +39,7 @@ echo "SELECT table_name FROM information_schema.TABLES  WHERE TABLE_SCHEMA='${DB
 $MYSQLCMD < civicrm.mysql
 $MYSQLCMD < civicrm_data.mysql
 $MYSQLCMD < civicrm_sample.mysql
+echo "DROP TABLE IF EXISTS zipcodes" | $MYSQLCMD
 $MYSQLCMD < zipcodes.mysql
 php GenerateData.php