diff --git a/airtime_mvc/application/common/ProvisioningHelper.php b/airtime_mvc/application/common/ProvisioningHelper.php index 9804e7d6e..9cc69ab5e 100644 --- a/airtime_mvc/application/common/ProvisioningHelper.php +++ b/airtime_mvc/application/common/ProvisioningHelper.php @@ -36,10 +36,13 @@ class ProvisioningHelper $this->parsePostParams(); //For security, the Airtime Pro provisioning system creates the database for the user. - // $this->setNewDatabaseConnection(); - //if ($this->checkDatabaseExists()) { - // throw new Exception("ERROR: Airtime database already exists"); - //} + $this->setNewDatabaseConnection(); + + //We really want to do this check because all the Propel-generated SQL starts with "DROP TABLE IF EXISTS". + //If we don't check, then a second call to this API endpoint would wipe all the tables! + if ($this->checkDatabaseExists()) { + throw new Exception("ERROR: Airtime database already exists"); + } //$this->createDatabase(); //All we need to do is create the database tables.