File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -89,10 +89,11 @@ private function safelyDropTable($table)
8989 $ schema = $ this ->connection ->getSchemaManager ();
9090 $ schema ->dropTable ($ table );
9191
92- $ queryEnablingCardinalityChecks = $ instructions ['needsTableIsolation ' ] ?
93- sprintf ($ instructions ['enable ' ], $ table ) :
94- $ instructions ['enable ' ];
95- $ this ->connection ->query ($ queryEnablingCardinalityChecks );
92+ // When table is already dropped we cannot enable any cardinality checks on it
93+ // See https://github.com/laravel-doctrine/migrations/issues/50
94+ if (!$ instructions ['needsTableIsolation ' ]) {
95+ $ this ->connection ->query ($ instructions ['enable ' ]);
96+ }
9697 }
9798
9899 /**
@@ -103,7 +104,6 @@ private function getCardinalityCheckInstructions()
103104 return [
104105 'mssql ' => [
105106 'needsTableIsolation ' => true ,
106- 'enable ' => 'ALTER TABLE %s NOCHECK CONSTRAINT ALL ' ,
107107 'disable ' => 'ALTER TABLE %s CHECK CONSTRAINT ALL ' ,
108108 ],
109109 'mysql ' => [
@@ -113,7 +113,6 @@ private function getCardinalityCheckInstructions()
113113 ],
114114 'postgresql ' => [
115115 'needsTableIsolation ' => true ,
116- 'enable ' => 'ALTER TABLE %s ENABLE TRIGGER ALL ' ,
117116 'disable ' => 'ALTER TABLE %s DISABLE TRIGGER ALL ' ,
118117 ],
119118 'sqlite ' => [
You can’t perform that action at this time.
0 commit comments