File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
src/Illuminate/Database/Console/Migrations Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,11 @@ class TableGuesser
14
14
'/.+_(to|from|in)_(\w+)$/ ' ,
15
15
];
16
16
17
+ const DROP_PATTERNS = [
18
+ '/^drop_(\w+)_table$/ ' ,
19
+ '/^drop_(\w+)$/ ' ,
20
+ ];
21
+
17
22
/**
18
23
* Attempt to guess the table name and "creation" status of the given migration.
19
24
*
@@ -33,5 +38,11 @@ public static function guess($migration)
33
38
return [$ matches [2 ], $ create = false ];
34
39
}
35
40
}
41
+
42
+ foreach (self ::DROP_PATTERNS as $ pattern ) {
43
+ if (preg_match ($ pattern , $ migration , $ matches )) {
44
+ return [$ matches [1 ], $ create = false ];
45
+ }
46
+ }
36
47
}
37
48
}
Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ public function testMigrationIsProperlyParsed()
28
28
[$ table , $ create ] = TableGuesser::guess ('drop_status_column_from_users_table ' );
29
29
$ this ->assertSame ('users ' , $ table );
30
30
$ this ->assertFalse ($ create );
31
+
32
+ [$ table , $ create ] = TableGuesser::guess ('drop_users_table ' );
33
+ $ this ->assertSame ('users ' , $ table );
34
+ $ this ->assertFalse ($ create );
31
35
}
32
36
33
37
public function testMigrationIsProperlyParsedWithoutTableSuffix ()
@@ -51,5 +55,9 @@ public function testMigrationIsProperlyParsedWithoutTableSuffix()
51
55
[$ table , $ create ] = TableGuesser::guess ('drop_status_column_from_users ' );
52
56
$ this ->assertSame ('users ' , $ table );
53
57
$ this ->assertFalse ($ create );
58
+
59
+ [$ table , $ create ] = TableGuesser::guess ('drop_users ' );
60
+ $ this ->assertSame ('users ' , $ table );
61
+ $ this ->assertFalse ($ create );
54
62
}
55
63
}
You can’t perform that action at this time.
0 commit comments