id(); $table->foreignId('actor_id')->constrained('users')->restrictOnDelete(); $table->foreignId('party_id')->constrained()->restrictOnDelete(); $table->foreignId('offer_id')->constrained()->restrictOnDelete(); $table->text('reason'); $table->timestamps(); }); Schema::create('orders', function (Blueprint $table) { $table->id(); $table->foreignId('user_id')->constrained()->restrictOnDelete(); $table->foreignId('party_id')->constrained()->restrictOnDelete(); $table->string('status'); $table->string('holder_kind'); $table->timestamps(); }); Schema::create('order_lines', function (Blueprint $table) { $table->id(); $table->foreignId('order_id')->constrained()->cascadeOnDelete(); $table->foreignId('offer_version_id')->constrained()->restrictOnDelete(); $table->unsignedInteger('price_cents'); $table->string('term_rule'); $table->string('update_promise'); $table->string('holder_kind'); $table->timestamps(); $table->unique(['order_id', 'offer_version_id']); }); Schema::create('order_scope_items', function (Blueprint $table) { $table->id(); $table->foreignId('order_line_id')->constrained()->cascadeOnDelete(); $table->foreignId('license_article_id')->constrained()->restrictOnDelete(); $table->foreignId('rights_profile_version_id')->constrained()->restrictOnDelete(); $table->json('rights_snapshot'); $table->timestamps(); $table->unique(['order_line_id', 'license_article_id', 'rights_profile_version_id'], 'order_scope_unique'); }); Schema::create('payments', function (Blueprint $table) { $table->id(); $table->foreignId('order_id')->constrained()->cascadeOnDelete(); $table->string('provider'); $table->string('status'); $table->string('provider_reference')->unique(); $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('payments'); Schema::dropIfExists('order_scope_items'); Schema::dropIfExists('order_lines'); Schema::dropIfExists('orders'); Schema::dropIfExists('manual_grants'); } };