fix: update coupon_limitquantity and createdate default

This commit is contained in:
Noah Lancien 2025-11-13 17:44:54 +01:00
parent d4fcdc8df0
commit c08c0e8fcd
2 changed files with 43 additions and 0 deletions

View file

@ -1,5 +1,7 @@
<?php
use Illuminate\Database\DBAL\TimestampType;
return [
/*
@ -124,4 +126,10 @@ return [
],
'dbal' => [
'types' => [
'timestamp' => TimestampType::class,
],
],
];

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class FixCouponNullableFields extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('coupon', function (Blueprint $table) {
// 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();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('coupon', function (Blueprint $table) {
$table->integer('coupon_limitquantity')->nullable(false)->default(1)->change();
});
}
}