db seeder

This commit is contained in:
2023-03-03 15:43:38 +01:00
parent 3d13369e05
commit 798996b615
7 changed files with 124 additions and 39 deletions

View File

@@ -12,14 +12,22 @@ return new class extends Migration
*/
public function up(): void
{
Schema::create('commandes', function (Blueprint $table) {
Schema::create('commandes', function (Blueprint $table){
$table->engine = 'InnoDB';
$table->bigIncrements('id')->unsigned();
$table->date('date')->nullable();
$table->json('adresse')->default(new Expression('(JSON_OBJECT())'));
$table->date('date');
$table->bigInteger('clients_id')->unsigned();
$table->json("adresse")->default(new Expression('(JSON_OBJECT())'));
$table->timestamps();
$table->index("date");
$table->index("clients_id");
});
Schema::table('commandes', function (Blueprint $table){
$table->foreign('clients_id')->references('id')->on('clients')->onUpdate('cascade')->onDelete('cascade');
});
}
@@ -28,6 +36,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::dropIfexists('commandes');
Schema::dropIfExists('commandes');
}
};