Skip to content

Commit 6aedece

Browse files
Update 2021_05_28_121021_add_index_key_people_table.php
1 parent b117c63 commit 6aedece

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/migrations/2021_05_28_121021_add_index_key_people_table.php

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)