diff --git a/database/migrations/2023_08_31_224314_remove_status_and_update_media_table.php b/database/migrations/2023_08_31_224314_remove_status_and_update_media_table.php new file mode 100644 index 0000000..04efdc4 --- /dev/null +++ b/database/migrations/2023_08_31_224314_remove_status_and_update_media_table.php @@ -0,0 +1,37 @@ +where('status', '<>', 'OK')->delete(); + + // Remove the 'status' column from the 'media' table + Schema::table('media', function (Blueprint $table) { + $table->dropColumn('status'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + // Add the 'status' column back with a default value of an empty string + Schema::table('media', function (Blueprint $table) { + $table->string('status')->default(''); + }); + + // Update the 'status' column of all rows to 'OK' + DB::table('media')->update(['status' => 'OK']); + } +};