id('id'); $table->foreignUuid("userId")->references("uuid")->on("users"); // Address validation for international users is basically impossible so just use a string $table->string("addres"); $table->timestamps(); }); Schema::create('orders', function (Blueprint $table) { $table->uuid("uuid")->unique()->primary(); $table->boolean("fulfilled")->default(false); $table->foreignUuid("userId")->references("uuid")->on("users"); $table->foreignId("addressId")->nullable()->references("id")->on("addresses"); $table->decimal("cost"); $table->boolean("paid")->default(false); $table->timestamps(); }); Schema::create("orderProduct", function (Blueprint $table) { $table->foreignUuid("productId")->references("uuid")->on("products")->cascadeOnUpdate()->cascadeOnDelete(); $table->foreignUuid("orderId")->references("uuid")->on("orders")->cascadeOnUpdate()->cascadeOnDelete(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('orderProduct'); Schema::dropIfExists('orders'); Schema::dropIfExists('addresses'); } }