From c08c0e8fcd44b3f06822012d43d85baa764ffda5 Mon Sep 17 00:00:00 2001 From: Noah Lancien Date: Thu, 13 Nov 2025 17:44:54 +0100 Subject: [PATCH 1/2] fix: update coupon_limitquantity and createdate default --- config/database.php | 8 +++++ ...1_13_171048_fix_coupon_nullable_fields.php | 35 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 database/migrations/2025_11_13_171048_fix_coupon_nullable_fields.php diff --git a/config/database.php b/config/database.php index 42ecfe2..bdaf8b9 100644 --- a/config/database.php +++ b/config/database.php @@ -1,5 +1,7 @@ [ + 'types' => [ + 'timestamp' => TimestampType::class, + ], + ], + ]; diff --git a/database/migrations/2025_11_13_171048_fix_coupon_nullable_fields.php b/database/migrations/2025_11_13_171048_fix_coupon_nullable_fields.php new file mode 100644 index 0000000..adaa2b3 --- /dev/null +++ b/database/migrations/2025_11_13_171048_fix_coupon_nullable_fields.php @@ -0,0 +1,35 @@ +timestamp('coupon_createdate')->useCurrent()->change(); + $table->integer('coupon_limitquantity')->nullable()->default(null)->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('coupon', function (Blueprint $table) { + $table->integer('coupon_limitquantity')->nullable(false)->default(1)->change(); + }); + } +} From 2485d0aa97b763cfbd3caade82e1dc9956e6d9cd Mon Sep 17 00:00:00 2001 From: Noah Lancien Date: Fri, 14 Nov 2025 09:54:33 +0100 Subject: [PATCH 2/2] fix: make coupon_limitperiod nullable --- .../migrations/2025_11_13_171048_fix_coupon_nullable_fields.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/database/migrations/2025_11_13_171048_fix_coupon_nullable_fields.php b/database/migrations/2025_11_13_171048_fix_coupon_nullable_fields.php index adaa2b3..ae2bff3 100644 --- a/database/migrations/2025_11_13_171048_fix_coupon_nullable_fields.php +++ b/database/migrations/2025_11_13_171048_fix_coupon_nullable_fields.php @@ -18,6 +18,7 @@ class FixCouponNullableFields extends Migration // Change from 0000-00-00 00:00:00 to current_timestamp. No need to revert. $table->timestamp('coupon_createdate')->useCurrent()->change(); $table->integer('coupon_limitquantity')->nullable()->default(null)->change(); + $table->integer('coupon_limitperiod')->nullable()->default(null)->change(); }); } @@ -30,6 +31,7 @@ class FixCouponNullableFields extends Migration { Schema::table('coupon', function (Blueprint $table) { $table->integer('coupon_limitquantity')->nullable(false)->default(1)->change(); + $table->integer('coupon_limitperiod')->nullable(false)->default(0)->change(); }); } }