$connected = AirtimeInstall::DbConnect(false); if ($connected) { echo " * Couldn't delete the database, so deleting all the DB tables..." . PHP_EOL; $con = Propel::getConnection(); $sql = "select * from pg_tables where tableowner = 'airtime'"; try { $rows = $con->query($sql)->fetchAll(); } catch (Exception $e) { $rows = array(); } foreach ($rows as $row) { $tablename = $row["tablename"]; echo " * Removing database table {$tablename}..."; $sql = "DROP TABLE {$tablename} CASCADE"; AirtimeInstall::InstallQuery($sql, false); AirtimeInstall::DropSequence($tablename . "_id"); echo "done." . PHP_EOL; } echo " * Deleting database sequences..." . PHP_EOL; $sql = "SELECT c.relname FROM pg_class c WHERE c.relkind = 'S';"; try { $rows = $con->query($sql)->fetchAll(); } catch (Exception $e) { $rows = array(); } foreach ($rows as $row) { $sequence = $row["relname"]; echo " * Removing database sequence {$sequence}..."; $sql = "DROP SEQUENCE {$sequence} CASCADE"; AirtimeInstall::InstallQuery($sql, false); echo "done." . PHP_EOL;