diff --git a/database/migrations/2023_01_20_151627_add_timestamps_to_modules_table.php b/database/migrations/2023_01_20_151627_add_timestamps_to_modules_table.php new file mode 100644 index 0000000..85a3609 --- /dev/null +++ b/database/migrations/2023_01_20_151627_add_timestamps_to_modules_table.php @@ -0,0 +1,39 @@ +timestamps(); + }); + + // 刷新时间戳 + DB::table('modules')->update([ + 'created_at' => DB::raw('NOW()'), + 'updated_at' => DB::raw('NOW()'), + ]); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Schema::table('modules', function (Blueprint $table) { + $table->dropColumn('created_at'); + $table->dropColumn('updated_at'); + }); + } +};