From 60b3593a8fbeba0a88f3446523ee24fef2963d51 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Fri, 20 Jan 2023 15:34:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=88=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...151627_add_timestamps_to_modules_table.php | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 database/migrations/2023_01_20_151627_add_timestamps_to_modules_table.php 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'); + }); + } +};