add migrations generate from a database exported from workbench

This commit is contained in:
Alexis Gousseau 2023-02-23 10:15:33 +01:00
parent f7f14c6283
commit ae78c6d1fe
28 changed files with 1620 additions and 910 deletions

View file

@ -12,6 +12,7 @@
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"kitloong/laravel-migrations-generator": "^6.8",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",

1586
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('password_reset_tokens');
}
};

View file

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};

View file

@ -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('brands', function (Blueprint $table) {
$table->comment('');
$table->bigInteger('id', true);
$table->string('brand')->comment('Nom de la marque, auto suggestion sur la table brand');
$table->string('filter')->nullable()->comment('Champ pour gérer le filtrage des marques dans les différents select de l\'application');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('brands');
}
};

View file

@ -0,0 +1,46 @@
<?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('ingredients', function (Blueprint $table) {
$table->comment('');
$table->bigInteger('id', true);
$table->bigInteger('user_id')->index();
$table->string('name')->comment('Nom du produit ou de la gamme');
$table->string('supplier')->comment('Fournisseur');
$table->tinyInteger('origin')->comment('Origine de l\'information (valeur de l\'enum InformationOriginEnum)');
$table->boolean('is_sample')->unsigned()->comment('Echantillon');
$table->tinyInteger('family')->comment('Famille Ingrédients (valeur de l\'enum FamilyIngredientEnum)');
$table->string('packing')->nullable()->comment('Conditionnement Ingrédients - not null si family (FamilyIngredientEnum) = "Fruits et légumes" ou "Epices et aromates" - Tableau de INT des PackingIngredientEnum');
$table->string('function')->nullable()->comment('Fonction Ingrédients - not null si family (FamilyIngredientEnum) = "Mix fonctionnel/ingrédients simples" - Tableau de INT des FunctionIngredientEnum');
$table->text('observation')->nullable()->comment('Observations - texte libre');
$table->string('picture')->nullable()->comment('Image de l\'ingrédient - 1 path de visuel de référence - 1 doc JPG ou JPEG (recommandé) - redimenssioner 1200x900');
$table->string('url')->nullable()->comment('url nullable - si not null:validation URL');
$table->text('documents')->nullable()->comment('Doc complémentaires (Annexes) - Tableau de string contenant les paths des docs uploadés associés (docs complémentaires) - 0 a 5 docs ');
$table->string('fair')->nullable()->comment('not null si origin (InformationOriginEnum) == salon');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('ingredients');
}
};

View 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('keywordables', function (Blueprint $table) {
$table->comment('');
$table->bigInteger('id', true);
$table->bigInteger('keyword_id')->index();
$table->bigInteger('keywordable_id');
$table->string('model');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('keywordables');
}
};

View file

@ -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('keywords', function (Blueprint $table) {
$table->comment('');
$table->bigInteger('id', true);
$table->string('label')->comment('unique with keyword_cat');
$table->string('keyword_cat')->comment(' unique with label (valeur de l\'enum KeywordCategoryEnum)');
$table->timestamps();
$table->unique(['label', 'keyword_cat']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('keywords');
}
};

View file

@ -0,0 +1,48 @@
<?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('packagings', function (Blueprint $table) {
$table->comment('');
$table->bigInteger('id', true);
$table->bigInteger('user_id')->index();
$table->unsignedTinyInteger('watch_type')->comment('Type de veille (valeur de l\'enum WatchTypeEnum) (produit fini, emballage mais attention ne pas mettre "process")');
$table->string('supplier')->comment('si watch_type (WatchTypeEnum)="produit fini" alors correspond à "Marque de produit" - si watch_type (WatchTypeEnum)= "emballage" alors correspond à "Fournisseur" ');
$table->string('name')->comment('si watch_type (WatchTypeEnum)="produit fini" alors sur front "nom du produit" - si watch_type (WatchTypeEnum)="emballage" alors sur front "emballage"');
$table->text('product_description')->nullable()->comment('not null si watch_type (valeur de l\'enum WatchTypeEnum) = "produit fini"');
$table->unsignedTinyInteger('origin')->comment('Origine de de l\'information (valeur de InformationOriginEnum)');
$table->boolean('is_sample')->unsigned()->comment('Échantillon');
$table->unsignedTinyInteger('type_packaging')->comment('Required (valeur de l\'enum TypePackagingEnum)');
$table->unsignedTinyInteger('material')->comment('Required (valeur de l\'enum MaterialEnum)');
$table->unsignedTinyInteger('benefit')->comment('Required (valeur de l\'enum BenefitEnum)');
$table->text('observation')->nullable()->comment('Texte libre - nullable');
$table->string('picture')->nullable()->comment('Image - 1 path du visuel de référence - Redimensioner 1200x900');
$table->string('url')->nullable()->comment('url nullable - si not null: valider url avec une validation laravel');
$table->text('documents')->nullable()->comment('Documents - Tableau de string contenant les paths des docs uploadés associés (docs complémentaires) - 0 a 5 docs (recommandé)');
$table->string('fair')->nullable()->comment('not null si origin (valeur de l\'enum InformationOriginEnum) == salon');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('packagings');
}
};

View file

@ -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('process_has_process_types', function (Blueprint $table) {
$table->comment('');
$table->bigInteger('process_id')->index();
$table->bigInteger('process_type_id')->index();
$table->string('value_enum')->comment('Not Null si process_type = "Préparation Viande": Tableau de INT contenant les valeurs de MeatPreparationEnum - Not Null si process_type = "Conditionnement primaire": Tableau de INT contenant les valeurs de PrimaryPackingEnum');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('process_has_process_types');
}
};

View file

@ -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::create('process_types', function (Blueprint $table) {
$table->comment('');
$table->bigInteger('id', true);
$table->string('name')->comment('sur le front cela correspond au select "Type de process"');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('process_types');
}
};

View file

@ -0,0 +1,47 @@
<?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('processes', function (Blueprint $table) {
$table->comment('');
$table->bigInteger('id', true);
$table->bigInteger('user_id')->index();
$table->unsignedTinyInteger('watch_type')->comment('Type de veille (valeur de l\'enum WatchTypeEnum) (produit fini, emballage, process)');
$table->string('supplier')->comment('Fournisseur (ou Marque de produit) - Champ libre - si watch_type (WatchTypetEnum) = "Process" ou "Emballage" alors front a pour label "fournisseur" - si watch_type (WatchTypetEnum) = "Produit fini" alors front a pour label "marque du produit"');
$table->string('name')->comment('Nom produit (ou Emballage ou nom machine) - Champ libre - si watch_type (valeur de l\'enum WatchTypetEnum) = "Process" alors front a pour label "nom machine" - si watch_type (valeur de l\'enum WatchTypetEnum) = "Emballage" - alors front a pour label "emballage" - si watch_type (valeur de l\'enum WatchTypetEnum)= "Produit fini" alors front a pour label "nom du produit"');
$table->text('description')->nullable()->comment('Descriptif - Nullable - Not null si watch_type (valeur de l\'enum WatchTypetEnum) = "Process"');
$table->unsignedTinyInteger('origin')->comment('Origin - (valeur de l\'enum OriginEnum) - Required');
$table->boolean('is_test_machine')->unsigned()->comment('boolean - Test machine ? oui - non');
$table->boolean('is_quotation')->unsigned()->comment('Boolean');
$table->string('quotation_document')->nullable()->comment('Devis - Nullable si `is_quotation` = 0 - Not null si `is_quotation`= 1: 1 doc - 1 path à stocker en string');
$table->unsignedTinyInteger('profit')->comment('Benefice - Required (valeur de l\'enum BenefitEnum)');
$table->text('observation')->nullable()->comment('observations - nullable');
$table->text('picture')->nullable()->comment('Tableau de string contenant les paths des docs uploadés associés (visuels de référence) - 0 a 5 docs JPG ou JPEG (recommandé) - Redimenssioner 1200x900 (h)');
$table->text('documents')->nullable()->comment('Tableau de string contenant les paths des docs uploadés associés (docs complémentaires) - 0 a 5 docs (recommandé)');
$table->string('url')->nullable()->comment('url nullable - si not null: valider url avec une validation laravel');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('processes');
}
};

View 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('product_comments', function (Blueprint $table) {
$table->comment('');
$table->bigInteger('id', true);
$table->bigInteger('product_id')->index();
$table->string('evaluation')->comment('Appréciation globale - Required');
$table->string('aspect')->nullable()->comment('Aspect');
$table->string('taste')->nullable();
$table->string('odor')->nullable();
$table->string('texture')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('product_comments');
}
};

View file

@ -0,0 +1,58 @@
<?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('products', function (Blueprint $table) {
$table->comment('');
$table->bigInteger('id', true);
$table->bigInteger('user_id')->index();
$table->bigInteger('brand_id')->index()->comment('Marque - Required - Texte libre avec auto-suggestion sur la table elle même');
$table->string('name')->comment('Nom du produit - Required');
$table->timestamp('entry_date')->useCurrentOnUpdate()->useCurrent()->comment('Date (date de saisie) - Required');
$table->unsignedTinyInteger('source')->comment('Source - Required - (valeur de l\'enum SourceEnum) -> champ SELECT');
$table->string('fair')->nullable()->comment('Salon - Affiché en front si SourceEnum = Salon Professionnel ou Salon Clients ou Salon Grand Public - Texte libre avec auto-suggestion sur la table elle même');
$table->string('shop')->nullable()->comment('Magasin - Affiché en front si SourceEnum = Magasin - Texte libre avec auto-suggestion sur la table elle même');
$table->string('catalogue')->nullable()->comment('Catalogue - Affiché en front si SourceEnum = Catalogue Argumentaire - Texte libre avec auto-suggestion sur la table elle même');
$table->string('gencod', 15)->nullable()->comment('Gencod - Suite de 13 chiffres - En front, on a une vérification Ajax une fois le code saisie pour proposer une duplication');
$table->string('picture')->nullable()->comment('Visuel de référence - Path - Taille de l\'image 1200*900');
$table->longText('docs')->nullable()->comment('Docs complémentaires - Tableau de path - 0 a 5 docs PDF');
$table->string('url')->nullable()->comment('URL - Validation URL+ No BO');
$table->unsignedTinyInteger('certification')->nullable()->comment('Certification - CertificationEnum');
$table->text('origins')->nullable()->comment('Origine - Tableau d\'Enum (entier) JSON (valeur de l\'enum OriginEnum)');
$table->text('claims')->nullable()->comment('Autres allégations - Tableau d\'Enum (entier) JSON (valeur de l\'enum ClaimEnum)');
$table->string('specified_claim')->nullable()->comment('Précisez l\'allégation - Required if ClaimEnum = Autres - Text libre');
$table->unsignedTinyInteger('distribution_network')->comment('Réseau de distribution - Required (valeur de l\'enum DistributionNetworkEnum)');
$table->unsignedTinyInteger('ray')->comment('Rayon - Required (valeur de l\'enum RayEnum)');
$table->unsignedTinyInteger('product_range')->comment('Famille de produit - Required (valeur de l\'enum ProductRangeEnum)');
$table->unsignedTinyInteger('geo_area')->comment('Zone géographique - Required (valeur de l\'enum GeoAreaEnum)');
$table->integer('weight')->nullable()->comment('Poids - Unité en grammes');
$table->integer('pvc')->nullable()->comment('PVC de l\'UVC - Stocké en centimes - Prix en euros');
$table->text('comment')->nullable()->comment('Commentaire Libre');
$table->boolean('is_tasted')->unsigned()->comment('Produit dégusté ? - Boolean - Required');
$table->smallInteger('tasters_number')->nullable()->comment('Nombre de dégustateurs - Required if is_tasted = true - Max 15');
$table->timestamps();
$table->softDeletes()->comment('Soft delete');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('products');
}
};

View file

@ -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('promo_distribution_networks', function (Blueprint $table) {
$table->comment('');
$table->bigInteger('id', true);
$table->unsignedTinyInteger('name')->comment('Required - Niveau 1 (valeur de l\'enum DistributionNetworkEnum) - Seeder niveau 2 dans le champ label (valeur de l\'enum LabelDistributionNetworkEnum)');
$table->string('label')->comment('Seedé dans l\'application en fonction de network_name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('promo_distribution_networks');
}
};

View file

@ -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('promo_types', function (Blueprint $table) {
$table->comment('');
$table->bigInteger('id')->primary();
$table->tinyInteger('name')->comment('Required - Niveau 1 - (valeur de l\'enum TypePromoEnum) - Seeder niveau 2: champ label (valeur de l\'enum LabelTypePromoEnum)');
$table->string('label')->comment('Seedé dans l\'application en fonction de name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('promo_types');
}
};

View file

@ -0,0 +1,49 @@
<?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('promos', function (Blueprint $table) {
$table->comment('');
$table->bigInteger('id', true);
$table->bigInteger('user_id')->index();
$table->bigInteger('promo_type_id')->index();
$table->bigInteger('promo_distribution_network_id')->index();
$table->bigInteger('brand_id')->index();
$table->timestamp('date')->useCurrentOnUpdate()->useCurrent()->comment('Date libre - Nullable');
$table->unsignedTinyInteger('source')->comment('(valeur de l\'enum SourceEnum)');
$table->string('shop_name')->nullable()->comment('Nom Magasin - NOT NULL si source (valeur de l\'enum SourceEnum) = "tournée terrain" ou "remontée chef seccteur" ');
$table->string('shop_city')->nullable()->comment('Ville du magasin - NOT NULL si source (valeur de l\'enum SourceEnum) = "tournée terrain" ou "remontée chef seccteur" - Pattern: CP sur 2 chiffres + \' \' + VILLE - Pattern ex: "85 CHALLANS"');
$table->string('sector_chief')->nullable()->comment('NOT NULL si source (valeur de l\'enum SourceEnum) = "remontée chef secteur" ');
$table->string('name')->nullable()->comment('Texte libre avec auto-suggestion sur la table promos');
$table->tinyInteger('target')->comment('Cible (valeur de l\'enum TargetEnum)');
$table->tinyInteger('angle')->comment('Angle (valeur de l\'enum AngleEnum)');
$table->tinyInteger('event')->comment('Evenement (valeur de l\'enum EventEnum)');
$table->string('url')->nullable()->comment('NOT NULL si source (valeur de l\'enum SourceEnum) = "pige web" - si not null: Validation URL');
$table->string('press')->nullable()->comment('NOT NULL si source (valeur de l\'enum SourceEnum) = "pige presse" ');
$table->string('fair')->nullable()->comment('Salon - NOT NULL si source (valeur de l\'enum SourceEnum) = "salon / évènementiel"');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('promos');
}
};

View file

@ -0,0 +1,43 @@
<?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('surveys', function (Blueprint $table) {
$table->comment('');
$table->bigInteger('id', true);
$table->bigInteger('user_id')->index();
$table->string('name')->comment('Nom de l\'étude');
$table->string('author')->nullable()->comment('Auteur de l\'étude, champs libre');
$table->text('comment')->comment('Note de synthèse - Required');
$table->timestamp('date')->nullable()->comment('Date de saisie - Nullable');
$table->text('documents')->nullable()->comment('Tableau de string contenant les paths des docs uploadés associés');
$table->boolean('is_distributor')->unsigned()->default(false)->comment('Boolean - If true select DistributionNetworkEnum');
$table->boolean('is_customer')->unsigned()->default(false)->comment('Boolean - If true select CustomerEnum');
$table->unsignedTinyInteger('type')->comment('Valeur de l\'enum en fonction is_distributor ou is_customer');
$table->timestamps();
$table->softDeletes()->comment('Soft Delete
https://laravel.com/docs/9.x/migrations#column-method-softDeletes');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('surveys');
}
};

View file

@ -8,24 +8,26 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->comment('');
$table->bigInteger('id', true);
$table->string('firstname');
$table->string('lastname');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::dropIfExists('users');
}

View file

@ -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('ingredients', function (Blueprint $table) {
$table->foreign(['user_id'])->references(['id'])->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('ingredients', function (Blueprint $table) {
$table->dropForeign('ingredients_user_id_foreign');
});
}
};

View file

@ -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('keywordables', function (Blueprint $table) {
$table->foreign(['keyword_id'])->references(['id'])->on('keywords')->onUpdate('NO ACTION')->onDelete('NO ACTION');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('keywordables', function (Blueprint $table) {
$table->dropForeign('keywordables_keyword_id_foreign');
});
}
};

View file

@ -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('packagings', function (Blueprint $table) {
$table->foreign(['user_id'])->references(['id'])->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('packagings', function (Blueprint $table) {
$table->dropForeign('packagings_user_id_foreign');
});
}
};

View file

@ -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('process_has_process_types', function (Blueprint $table) {
$table->foreign(['process_id'])->references(['id'])->on('processes');
$table->foreign(['process_type_id'])->references(['id'])->on('process_types');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('process_has_process_types', function (Blueprint $table) {
$table->dropForeign('process_has_process_types_process_id_foreign');
$table->dropForeign('process_has_process_types_process_type_id_foreign');
});
}
};

View file

@ -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('processes', function (Blueprint $table) {
$table->foreign(['user_id'])->references(['id'])->on('users')->onUpdate('NO ACTION')->onDelete('NO ACTION');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('processes', function (Blueprint $table) {
$table->dropForeign('processes_user_id_foreign');
});
}
};

View file

@ -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('product_comments', function (Blueprint $table) {
$table->foreign(['product_id'])->references(['id'])->on('products');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('product_comments', function (Blueprint $table) {
$table->dropForeign('product_comments_product_id_foreign');
});
}
};

View file

@ -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('products', function (Blueprint $table) {
$table->foreign(['brand_id'])->references(['id'])->on('brands');
$table->foreign(['user_id'])->references(['id'])->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('products', function (Blueprint $table) {
$table->dropForeign('products_brand_id_foreign');
$table->dropForeign('products_user_id_foreign');
});
}
};

View 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::table('promos', function (Blueprint $table) {
$table->foreign(['brand_id'])->references(['id'])->on('brands');
$table->foreign(['promo_type_id'])->references(['id'])->on('promo_types');
$table->foreign(['promo_distribution_network_id'])->references(['id'])->on('promo_distribution_networks');
$table->foreign(['user_id'])->references(['id'])->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('promos', function (Blueprint $table) {
$table->dropForeign('promos_brand_id_foreign');
$table->dropForeign('promos_promo_type_id_foreign');
$table->dropForeign('promos_promo_distribution_network_id_foreign');
$table->dropForeign('promos_user_id_foreign');
});
}
};

View file

@ -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('surveys', function (Blueprint $table) {
$table->foreign(['user_id'])->references(['id'])->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('surveys', function (Blueprint $table) {
$table->dropForeign('surveys_user_id_foreign');
});
}
};