File tree Expand file tree Collapse file tree 1 file changed +12
-16
lines changed Expand file tree Collapse file tree 1 file changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -13,16 +13,14 @@ class AddIndexKeyPeopleTable extends Migration
1313 */
1414 public function up ()
1515 {
16- if (Schema::hasColumn ('people ' , 'uid ' ))
17- {
18-
19- Schema::table ('people ' , function (Blueprint $ table ) {
20- {
16+
17+ if (Schema::hasTable ('people ' )) {
18+ Schema::table ('people ' , function (Blueprint $ table ) {
19+ if (Schema::hasColumn ('people ' , 'uid ' )) {
2120 $ table ->index (['id ' , 'uid ' ]);
22-
23- });
24-
25- }
21+ }
22+ });
23+ }
2624 }
2725
2826 /**
@@ -32,12 +30,10 @@ public function up()
3230 */
3331 public function down()
3432 {
35- Schema::table('people ' , function (Blueprint $ table ) {
36- if (Schema::hasColumn ('people ' , 'uid ' ))
37- {
38- {
33+ if (Schema::hasTable ('people ' )) {
34+ Schema::table ('people ' , function (Blueprint $ table ) {
35+ if (Schema::hasColumn ('people ' , 'uid ' )) {
3936 $ table ->dropIndex (['id ' , 'uid ' ]);
40- }
41- });
42- }
37+ }
38+ });
4339}
You can’t perform that action at this time.
0 commit comments