Page MenuHomePhorge

No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None
diff --git a/src/database/migrations/2021_04_08_160000_expires_at_column_fix.php b/src/database/migrations/2021_04_08_160000_expires_at_column_fix.php
new file mode 100644
index 00000000..47c72a2e
--- /dev/null
+++ b/src/database/migrations/2021_04_08_160000_expires_at_column_fix.php
@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Support\Facades\DB;
+
+// phpcs:ignore
+class ExpiresAtColumnFix extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ // This is to remove "ON UPDATE" clause from the column
+ // There's no way to do this with Laravel schema migration tools,
+ // we have to use raw queries.
+
+ // Note: Whenever you create a table with custom timestamp() column don't forget to use
+ // also one of nullable() or useCurrent() to make sure "ON UPDATE" is not added.
+
+ DB::statement("ALTER TABLE `signup_codes` MODIFY `expires_at`"
+ . " TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP");
+ DB::statement("ALTER TABLE `verification_codes` MODIFY `expires_at`"
+ . " TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP");
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ // empty
+ }
+}

File Metadata

Mime Type
text/x-diff
Expires
Tue, Feb 3, 3:32 AM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
427043
Default Alt Text
(1 KB)

Event Timeline