Merge branch 'migration-coupon' into 'develop'

fix: update coupon_limitquantity and createdate default

See merge request ldc-web/projets/mesbr!15
This commit is contained in:
Vincent BRIDIER 2025-11-14 08:53:53 +00:00
commit 0bed498489
2 changed files with 45 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,37 @@
<?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();
$table->integer('coupon_limitperiod')->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();
$table->integer('coupon_limitperiod')->nullable(false)->default(0)->change();
});
}
}