clean: re-generate migrations from 0 with kitloong/laravel-migrations-generator package
This commit is contained in:
parent
715c83f9fc
commit
6efc47a75d
33 changed files with 588 additions and 430 deletions
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSiteUserPivotTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// Schema::table('site', function (Blueprint $table) {
|
||||
// $table->dropPrimary('site_id');
|
||||
// $table->integer('id')->unsigned()->first()->autoIncrement();
|
||||
// $table->primary('id');
|
||||
// $table->engine = 'InnoDB';
|
||||
// });
|
||||
|
||||
Schema::create('site_user', function (Blueprint $table) {
|
||||
$table->integer('user_id')->unsigned()->nullable();
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->integer('site_id')->unsigned()->nullable();
|
||||
$table->foreign('site_id')->references('id')->on('site')->onDelete('cascade');
|
||||
$table->primary(['site_id', 'user_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('site_user');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddFieldsToSitesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('site', function (Blueprint $table) {
|
||||
$table->string('site_rcs', 100)->nullable();
|
||||
$table->string('site_libelle', 200)->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('site', function (Blueprint $table) {
|
||||
$table->dropColumn('site_rcs');
|
||||
$table->dropColumn('site_libelle');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddDiffusiondatefieldToCouponsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('coupon', function (Blueprint $table) {
|
||||
$table->date('coupon_maxdatediffusion')->nullable();
|
||||
$table->string('coupon_products_image', 500)->nullable();
|
||||
$table->string('coupon_validity_text', 500)->nullable();
|
||||
$table->string('coupon_legal_mentions', 500)->nullable();
|
||||
$table->dropColumn('coupon_quantity');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('coupon', function (Blueprint $table) {
|
||||
$table->integer('coupon_quantity');
|
||||
$table->dropColumn('coupon_maxdatediffusion');
|
||||
$table->dropColumn('coupon_products_image');
|
||||
$table->dropColumn('coupon_validity_text');
|
||||
$table->dropColumn('coupon_legal_mentions');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCampagneCouponPivotTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('campagne_coupon', function (Blueprint $table) {
|
||||
$table->integer('camp_id')->nullable();
|
||||
$table->foreign('camp_id')->references('camp_id')->on('campagne')->onDelete('cascade');
|
||||
$table->integer('coupon_id')->nullable();
|
||||
$table->foreign('coupon_id')->references('coupon_id')->on('coupon')->onDelete('cascade');
|
||||
$table->primary(['camp_id', 'coupon_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('campagne_coupon');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddTreatmentcenterToCoupons extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('coupon', function (Blueprint $table) {
|
||||
$table->integer('coupon_treatment_center')->default(1);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('coupon', function (Blueprint $table) {
|
||||
$table->dropColumn('coupon_treatment_center');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateFailedJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
<?php
|
||||
|
||||
use App\Coupon;
|
||||
use App\Site;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class MoveUploadedFilesToBuildFolder extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$couponModels = Coupon::query()->withTrashed()->get();
|
||||
foreach ($couponModels as $couponModel) {
|
||||
$couponModel->coupon_gs1code = self::getUpdatedFilePath($couponModel->coupon_gs1code ?? '');
|
||||
$couponModel->coupon_thumbnail1 = self::getUpdatedFilePath($couponModel->coupon_thumbnail1 ?? '');
|
||||
$couponModel->coupon_thumbnail2 = self::getUpdatedFilePath($couponModel->coupon_thumbnail2 ?? '');
|
||||
$couponModel->coupon_thumbnail3 = self::getUpdatedFilePath($couponModel->coupon_thumbnail3 ?? '');
|
||||
$couponModel->coupon_thumbnail4 = self::getUpdatedFilePath($couponModel->coupon_thumbnail4 ?? '');
|
||||
$couponModel->coupon_image = self::getUpdatedFilePath($couponModel->coupon_image ?? '');
|
||||
$couponModel->coupon_decoration_image = self::getUpdatedFilePath($couponModel->coupon_decoration_image ?? '');
|
||||
$couponModel->coupon_logo_image = self::getUpdatedFilePath($couponModel->coupon_logo_image ?? '');
|
||||
$couponModel->save();
|
||||
}
|
||||
|
||||
$siteModels = Site::query()->get();
|
||||
foreach ($siteModels as $siteModel) {
|
||||
$siteModel->site_logo = self::getUpdatedFilePath($siteModel->site_logo ?? '',);
|
||||
$siteModel->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$couponModels = Coupon::query()->withTrashed()->get();
|
||||
foreach ($couponModels as $couponModel) {
|
||||
$couponModel->coupon_gs1code = self::getOldFilePath($couponModel->coupon_gs1code ?? '');
|
||||
$couponModel->coupon_thumbnail1 = self::getOldFilePath($couponModel->coupon_thumbnail1 ?? '');
|
||||
$couponModel->coupon_thumbnail2 = self::getOldFilePath($couponModel->coupon_thumbnail2 ?? '');
|
||||
$couponModel->coupon_thumbnail3 = self::getOldFilePath($couponModel->coupon_thumbnail3 ?? '');
|
||||
$couponModel->coupon_thumbnail4 = self::getOldFilePath($couponModel->coupon_thumbnail4 ?? '');
|
||||
$couponModel->coupon_image = self::getOldFilePath($couponModel->coupon_image ?? '');
|
||||
$couponModel->coupon_decoration_image = self::getOldFilePath($couponModel->coupon_decoration_image ?? '');
|
||||
$couponModel->coupon_logo_image = self::getOldFilePath($couponModel->coupon_logo_image ?? '');
|
||||
$couponModel->save();
|
||||
}
|
||||
|
||||
$siteModels = Site::query()->get();
|
||||
foreach ($siteModels as $siteModel) {
|
||||
$siteModel->site_logo = self::getOldFilePath($siteModel->site_logo ?? '',);
|
||||
$siteModel->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the updated file path (with 'storage/modelfiles' instead of folder in public)
|
||||
* @param string $path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function getUpdatedFilePath(string $path): string
|
||||
{
|
||||
return !empty($path) ? Str::start($path, 'storage/modelfiles/') : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the old file path (with 'uploads/images' instead of 'storage/modelfiles')
|
||||
* @param string $path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function getOldFilePath(string $path): string
|
||||
{
|
||||
return Str::replaceFirst('storage/modelfiles/', '', $path);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('calendrier', function (Blueprint $table) {
|
||||
$table->integer('calendrier_id', true);
|
||||
$table->integer('calendrier_couponId')->default(0);
|
||||
$table->timestamp('calendrier_startdate')->default(DB::raw("'1970-01-01 00:00:01'"));
|
||||
$table->timestamp('calendrier_enddate')->default(DB::raw("'1970-01-01 00:00:01'"));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('calendrier');
|
||||
}
|
||||
};
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePasswordResetsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,10 +13,11 @@ class CreatePasswordResetsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->string('email')->index();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
Schema::create('campagne_coupon', function (Blueprint $table) {
|
||||
$table->integer('campagne_id');
|
||||
$table->integer('coup_id')->index('campagne_coupon_coupon_id_foreign');
|
||||
|
||||
$table->primary(['campagne_id', 'coup_id']);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -27,6 +28,6 @@ class CreatePasswordResetsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
Schema::dropIfExists('campagne_coupon');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('campagne', function (Blueprint $table) {
|
||||
$table->integer('camp_id', true);
|
||||
$table->string('camp_siteId', 50);
|
||||
$table->string('camp_name', 500)->default('');
|
||||
$table->integer('camp_type')->default(0)->comment('0 = mur; 1 = panier; 2 = mur sous forme de panier');
|
||||
$table->integer('camp_limitedPrinting')->default(0)->comment('Limite l\'impression des paniers à un BR à la fois');
|
||||
$table->integer('camp_published')->default(1);
|
||||
$table->timestamp('camp_createdate')->useCurrent();
|
||||
$table->timestamp('camp_updatedate')->useCurrentOnUpdate()->useCurrent();
|
||||
$table->timestamp('camp_deleted_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('campagne');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('contact', function (Blueprint $table) {
|
||||
$table->integer('contact_id', true);
|
||||
$table->string('contact_siteId', 50);
|
||||
$table->string('contact_ref', 200)->default('');
|
||||
$table->string('contact_prenom', 200)->default('');
|
||||
$table->string('contact_nom', 200)->default('');
|
||||
$table->string('contact_email', 200)->default('');
|
||||
$table->string('contact_cp', 50)->default('');
|
||||
$table->string('contact_ville', 200)->default('');
|
||||
$table->timestamp('contact_createdate')->useCurrent();
|
||||
$table->timestamp('contact_updatedate')->useCurrentOnUpdate()->useCurrent();
|
||||
$table->unsignedInteger('contact_country')->default(250);
|
||||
$table->string('contact_hash', 50)->nullable()->unique('contact_hash');
|
||||
|
||||
$table->index(['contact_ref', 'contact_email'], 'contact_ref');
|
||||
$table->index(['contact_email', 'contact_ref'], 'contact_email');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('contact');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('coupon', function (Blueprint $table) {
|
||||
$table->integer('coupon_id', true);
|
||||
$table->integer('coupon_siteId');
|
||||
$table->string('coupon_code', 50)->default('');
|
||||
$table->string('coupon_gs1code', 500)->default('');
|
||||
$table->string('coupon_name', 500)->default('');
|
||||
$table->float('coupon_value', 10, 0)->default(0);
|
||||
$table->string('coupon_thumbnail1', 500)->default('');
|
||||
$table->string('coupon_thumbnail2', 500)->default('');
|
||||
$table->string('coupon_thumbnail3', 500)->default('');
|
||||
$table->string('coupon_thumbnail4', 500)->default('');
|
||||
$table->string('coupon_image', 500)->default('');
|
||||
$table->integer('coupon_enablelimitquantity')->default(0);
|
||||
$table->integer('coupon_limitquantity')->default(1);
|
||||
$table->integer('coupon_enablelimitperiod')->default(0);
|
||||
$table->integer('coupon_limitperiod')->default(0);
|
||||
$table->integer('coupon_validity')->default(30);
|
||||
$table->date('coupon_mindatediffusion')->nullable();
|
||||
$table->date('coupon_maxdatediffusion')->nullable();
|
||||
$table->date('coupon_maxdatevalidity')->nullable();
|
||||
$table->integer('coupon_norme')->default(0)->comment('0 = par défaut; 1 = Benelux');
|
||||
$table->integer('coupon_published')->default(1);
|
||||
$table->timestamp('coupon_createdate')->useCurrent();
|
||||
$table->timestamp('coupon_updatedate')->useCurrentOnUpdate()->nullable()->useCurrent();
|
||||
$table->timestamp('coupon_deleted_at')->nullable();
|
||||
$table->string('coupon_decoration_image', 500)->nullable();
|
||||
$table->string('coupon_logo_image', 500)->nullable();
|
||||
$table->string('coupon_validity_text', 500)->nullable();
|
||||
$table->string('coupon_rcs', 500)->nullable();
|
||||
$table->string('coupon_legal_mentions', 1000)->nullable();
|
||||
$table->tinyInteger('coupon_legal_mentions_splitted')->default(0);
|
||||
$table->string('coupon_site_contact', 500)->nullable();
|
||||
$table->unsignedInteger('coupon_seuil_alert')->default(100);
|
||||
$table->integer('coupon_treatment_center')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('coupon');
|
||||
}
|
||||
};
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCustomersTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -14,11 +14,13 @@ class CreateCustomersTable extends Migration
|
|||
public function up()
|
||||
{
|
||||
Schema::create('customers', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('hashcode', 36)->unique();
|
||||
$table->string('email')->unique();
|
||||
$table->integer('country')->default('250');
|
||||
$table->bigInteger('id', true);
|
||||
$table->string('hashcode', 36)->default('');
|
||||
$table->string('email');
|
||||
$table->integer('country')->default(250);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['hashcode', 'email'], 'crm_id');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -31,4 +33,4 @@ class CreateCustomersTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('customers');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateLogsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -17,14 +17,15 @@ class CreateLogsTable extends Migration
|
|||
$table->increments('id');
|
||||
$table->integer('log_action');
|
||||
$table->string('log_refsite')->nullable();
|
||||
$table->integer('log_contactId')->nullable();
|
||||
$table->integer('log_contactId')->nullable()->index('FK_log_contact');
|
||||
$table->string('log_source');
|
||||
$table->text('log_params')->nullable();
|
||||
$table->string('log_statut');
|
||||
$table->text('log_message');
|
||||
$table->timestamp('created_at');
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -34,4 +35,4 @@ class CreateLogsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('logs');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMouvementsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -14,13 +14,11 @@ class CreateMouvementsTable extends Migration
|
|||
public function up()
|
||||
{
|
||||
Schema::create('mouvement', function (Blueprint $table) {
|
||||
$table->engine = 'MyISAM';
|
||||
$table->increments('mouvement_id');
|
||||
$table->unsignedInteger('mouvement_couponId');
|
||||
$table->string('mouvement_type', 50);
|
||||
$table->timestamp('mouvement_created_at');
|
||||
$table->unsignedInteger('mouvement_nombre');
|
||||
$table->string('mouvement_commentaire', 255)->nullable();
|
||||
$table->integer('mouvement_nombre');
|
||||
$table->string('mouvement_commentaire')->nullable();
|
||||
$table->timestamp('mouvement_created_at')->useCurrentOnUpdate()->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -33,4 +31,4 @@ class CreateMouvementsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('mouvement');
|
||||
}
|
||||
}
|
||||
};
|
||||
35
database/migrations/2025_04_11_100847_create_mur_table.php
Normal file
35
database/migrations/2025_04_11_100847_create_mur_table.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('mur', function (Blueprint $table) {
|
||||
$table->integer('mur_id', true);
|
||||
$table->integer('mur_campId')->index('FK_mur_campagne');
|
||||
$table->integer('mur_contactId')->index('mur_contactId');
|
||||
$table->integer('mur_couponId')->index('mur_couponId');
|
||||
$table->integer('mur_deleted')->default(0);
|
||||
$table->timestamp('mur_createdate')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('mur');
|
||||
}
|
||||
};
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddNameToNotifications extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,10 @@ class AddNameToNotifications extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('notification', function (Blueprint $table) {
|
||||
Schema::create('notification', function (Blueprint $table) {
|
||||
$table->integer('notif_id', true);
|
||||
$table->string('notif_email', 200)->default('');
|
||||
$table->integer('notif_campId');
|
||||
$table->string('notif_name', 100)->nullable();
|
||||
});
|
||||
}
|
||||
|
|
@ -25,8 +28,6 @@ class AddNameToNotifications extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('notification', function (Blueprint $table) {
|
||||
$table->dropColumn('notif_name');
|
||||
});
|
||||
Schema::dropIfExists('notification');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('panier_content', function (Blueprint $table) {
|
||||
$table->integer('panier_content_id', true);
|
||||
$table->integer('panier_content_panierId')->default(0)->index('FK_panier_content_panier');
|
||||
$table->integer('panier_content_couponId');
|
||||
$table->integer('panier_content_quantity')->default(0);
|
||||
$table->integer('panier_content_printed')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('panier_content');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('panier', function (Blueprint $table) {
|
||||
$table->integer('panier_id', true);
|
||||
$table->string('panier_ref', 100)->default('');
|
||||
$table->integer('panier_campId');
|
||||
$table->integer('panier_contactId')->index('FK_panier_contact');
|
||||
$table->integer('panier_pending')->default(1)->comment('1 = en cours; 0 = terminé');
|
||||
$table->timestamp('panier_createdate')->useCurrent();
|
||||
$table->timestamp('panier_updatedate')->useCurrentOnUpdate()->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('panier');
|
||||
}
|
||||
};
|
||||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DeletePasswordResetsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,11 @@ class DeletePasswordResetsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->string('email')->index();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -23,10 +27,6 @@ class DeletePasswordResetsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->string('email')->index();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
Schema::dropIfExists('password_resets');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('printed_walls', function (Blueprint $table) {
|
||||
$table->integer('camp_id')->index('FK_printed_wall_campagne');
|
||||
$table->integer('coupon_id')->index('FK_printed_wall_coupon');
|
||||
$table->bigInteger('customer_id')->index('FK_printed_wall_customers');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('printed_walls');
|
||||
}
|
||||
};
|
||||
38
database/migrations/2025_04_11_100847_create_site_table.php
Normal file
38
database/migrations/2025_04_11_100847_create_site_table.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('site', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('site_id', 50);
|
||||
$table->string('site_nom', 200)->default('');
|
||||
$table->string('site_logo', 500)->default('');
|
||||
$table->string('site_contact', 500)->default('');
|
||||
$table->string('site_rcs', 100)->nullable();
|
||||
$table->string('site_libelle', 200)->nullable();
|
||||
$table->string('crm_token')->nullable();
|
||||
$table->string('crm_password')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('site');
|
||||
}
|
||||
};
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddRolesToUsersTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,8 +13,11 @@ class AddRolesToUsersTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->text('roles')->nullable();
|
||||
Schema::create('site_user', function (Blueprint $table) {
|
||||
$table->unsignedInteger('user_id')->index('site_user_user_id_foreign');
|
||||
$table->unsignedInteger('site_id');
|
||||
|
||||
$table->primary(['site_id', 'user_id']);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -25,8 +28,6 @@ class AddRolesToUsersTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('roles');
|
||||
});
|
||||
Schema::dropIfExists('site_user');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateStatistiquesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -15,10 +15,10 @@ class CreateStatistiquesTable extends Migration
|
|||
{
|
||||
Schema::create('statistiques', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('stat_campId');
|
||||
$table->string('stat_couponId');
|
||||
$table->integer('stat_campId');
|
||||
$table->integer('stat_couponId');
|
||||
$table->integer('stat_couponPrinted');
|
||||
$table->timestamp('created_at');
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -31,4 +31,4 @@ class CreateStatistiquesTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('statistiques');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -16,11 +16,12 @@ class CreateUsersTable extends Migration
|
|||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('email');
|
||||
$table->string('email', 100)->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
$table->text('roles')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -33,4 +34,4 @@ class CreateUsersTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('campagne_coupon', function (Blueprint $table) {
|
||||
$table->foreign(['campagne_id'], 'campagne_coupon_camp_id_foreign')->references(['camp_id'])->on('campagne')->onDelete('CASCADE');
|
||||
$table->foreign(['coup_id'], 'campagne_coupon_coupon_id_foreign')->references(['coupon_id'])->on('coupon')->onDelete('CASCADE');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('campagne_coupon', function (Blueprint $table) {
|
||||
$table->dropForeign('campagne_coupon_camp_id_foreign');
|
||||
$table->dropForeign('campagne_coupon_coupon_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSeuilToCoupons extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,8 +13,8 @@ class AddSeuilToCoupons extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('coupon', function (Blueprint $table) {
|
||||
$table->unsignedInteger('coupon_seuil_alert')->default(100);
|
||||
Schema::table('logs', function (Blueprint $table) {
|
||||
$table->foreign(['log_contactId'], 'FK_log_contact')->references(['contact_id'])->on('contact')->onDelete('CASCADE');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -25,8 +25,8 @@ class AddSeuilToCoupons extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('coupon', function (Blueprint $table) {
|
||||
$table->dropColumn('coupon_seuil_alert');
|
||||
Schema::table('logs', function (Blueprint $table) {
|
||||
$table->dropForeign('FK_log_contact');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCountryfieldToContactTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,8 +13,8 @@ class AddCountryfieldToContactTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('contact', function (Blueprint $table) {
|
||||
$table->unsignedInteger('contact_country')->default(250);
|
||||
Schema::table('mur', function (Blueprint $table) {
|
||||
$table->foreign(['mur_contactId'], 'FK_mur_contact')->references(['contact_id'])->on('contact')->onDelete('CASCADE');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -25,8 +25,8 @@ class AddCountryfieldToContactTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('contact', function (Blueprint $table) {
|
||||
$table->dropColumn('contact_country');
|
||||
Schema::table('mur', function (Blueprint $table) {
|
||||
$table->dropForeign('FK_mur_contact');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('panier_content', function (Blueprint $table) {
|
||||
$table->foreign(['panier_content_panierId'], 'FK_panier_content_panier')->references(['panier_id'])->on('panier')->onDelete('CASCADE');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('panier_content', function (Blueprint $table) {
|
||||
$table->dropForeign('FK_panier_content_panier');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSoftDelete extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,8 +13,8 @@ class AddSoftDelete extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('campagne', function (Blueprint $table) {
|
||||
$table->softDeletes('camp_deleted_at');
|
||||
Schema::table('panier', function (Blueprint $table) {
|
||||
$table->foreign(['panier_contactId'], 'FK_panier_contact')->references(['contact_id'])->on('contact')->onDelete('CASCADE');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -25,8 +25,8 @@ class AddSoftDelete extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('campagne', function (Blueprint $table) {
|
||||
//
|
||||
Schema::table('panier', function (Blueprint $table) {
|
||||
$table->dropForeign('FK_panier_contact');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('printed_walls', function (Blueprint $table) {
|
||||
$table->foreign(['camp_id'], 'FK_printed_wall_campagne')->references(['camp_id'])->on('campagne');
|
||||
$table->foreign(['coupon_id'], 'FK_printed_wall_coupon')->references(['coupon_id'])->on('coupon');
|
||||
$table->foreign(['customer_id'], 'FK_printed_wall_customers')->references(['id'])->on('customers')->onDelete('CASCADE');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('printed_walls', function (Blueprint $table) {
|
||||
$table->dropForeign('FK_printed_wall_campagne');
|
||||
$table->dropForeign('FK_printed_wall_coupon');
|
||||
$table->dropForeign('FK_printed_wall_customers');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('site_user', function (Blueprint $table) {
|
||||
$table->foreign(['site_id'])->references(['id'])->on('site')->onDelete('CASCADE');
|
||||
$table->foreign(['user_id'])->references(['id'])->on('users')->onDelete('CASCADE');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('site_user', function (Blueprint $table) {
|
||||
$table->dropForeign('site_user_site_id_foreign');
|
||||
$table->dropForeign('site_user_user_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue