From d5e5644dbc65cb45feb501b9c471cfe838bcd02f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 27 Aug 2021 20:34:47 -0600 Subject: [PATCH] Migrations --- ...te_stories_table_fix_expires_at_column.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 database/migrations/2021_08_23_062246_update_stories_table_fix_expires_at_column.php diff --git a/database/migrations/2021_08_23_062246_update_stories_table_fix_expires_at_column.php b/database/migrations/2021_08_23_062246_update_stories_table_fix_expires_at_column.php new file mode 100644 index 000000000..be33dc3a3 --- /dev/null +++ b/database/migrations/2021_08_23_062246_update_stories_table_fix_expires_at_column.php @@ -0,0 +1,48 @@ +getDoctrineSchemaManager(); + $doctrineTable = $sm->listTableDetails('stories'); + + if($doctrineTable->hasIndex('stories_expires_at_index')) { + $table->dropIndex('stories_expires_at_index'); + } + $table->timestamp('expires_at')->default(null)->index()->nullable()->change(); + $table->boolean('can_reply')->default(true); + $table->boolean('can_react')->default(true); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('stories', function (Blueprint $table) { + $sm = Schema::getConnection()->getDoctrineSchemaManager(); + $doctrineTable = $sm->listTableDetails('stories'); + + if($doctrineTable->hasIndex('stories_expires_at_index')) { + $table->dropIndex('stories_expires_at_index'); + } + $table->timestamp('expires_at')->default(null)->index()->nullable()->change(); + $table->dropColumn('can_reply'); + $table->dropColumn('can_react'); + }); + } +}