Permalink
Browse files

Add IF EXISTS to all of our DROPsf

  • Loading branch information...
1 parent 6b1aa8b commit bdccd214b0d06406122056e0d04d5d8e049bcf77 @iarna iarna committed Apr 6, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 Modyllic/Generator/SQL.php
View
10 Modyllic/Generator/SQL.php
@@ -195,7 +195,7 @@ function drop( Modyllic_Schema $schema ) {
}
function drop_sqlmeta() {
- $this->cmd('DROP TABLE SQLMETA');
+ $this->cmd('DROP TABLE IF EXISTS SQLMETA');
}
// DATABASE
@@ -233,7 +233,7 @@ function alter_database($schema) {
function drop_database($schema) {
if ($schema->nameIsDefault) return $this;
- $this->cmd( "DROP DATABASE %id", $schema->name );
+ $this->cmd( "DROP DATABASE IF EXISTS %id", $schema->name );
return $this;
}
@@ -507,7 +507,7 @@ function alter_table( $table ) {
}
function drop_table( $table ) {
- $this->cmd( "DROP TABLE %id", $table->name );
+ $this->cmd( "DROP TABLE IF EXISTS %id", $table->name );
if ( count($this->table_meta($table)) > 0 ) {
$this->delete_meta("TABLE",$table->name);
}
@@ -757,7 +757,7 @@ function alter_view( $view ) {
}
function drop_view( $view ) {
- $this->cmd( "DROP VIEW %id", $view->name );
+ $this->cmd( "DROP VIEW IF EXISTS %id", $view->name );
return $this;
}
@@ -934,7 +934,7 @@ function create_function_name( $func ) {
return $this;
}
function drop_function( $func ) {
- $this->cmd( "DROP FUNCTION %id", $func->name );
+ $this->cmd( "DROP FUNCTION IF EXISTS %id", $func->name );
return $this;
}

0 comments on commit bdccd21

Please sign in to comment.