Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.x] Use morphs method in migrations #256

Merged
merged 12 commits into from
Apr 22, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ public function up(): void
{
Schema::create('customers', function (Blueprint $table) {
$table->id();
$table->foreignId('billable_id');
$table->string('billable_type');
$table->morphs('billable');
$table->string('paddle_id')->unique();
$table->string('name');
$table->string('email');
$table->timestamp('trial_ends_at')->nullable();
$table->timestamps();

$table->index(['billable_id', 'billable_type']);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@ public function up(): void
{
Schema::create('subscriptions', function (Blueprint $table) {
$table->id();
$table->foreignId('billable_id');
$table->string('billable_type');
$table->morphs('billable');
$table->string('type');
$table->string('paddle_id')->unique();
$table->string('status');
$table->timestamp('trial_ends_at')->nullable();
$table->timestamp('paused_at')->nullable();
$table->timestamp('ends_at')->nullable();
$table->timestamps();

$table->index(['billable_id', 'billable_type']);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public function up(): void
{
Schema::create('transactions', function (Blueprint $table) {
$table->id();
$table->foreignId('billable_id');
$table->string('billable_type');
$table->morphs('billable');
$table->string('paddle_id')->unique();
$table->string('paddle_subscription_id')->nullable()->index();
$table->string('invoice_number')->nullable();
Expand All @@ -24,8 +23,6 @@ public function up(): void
$table->string('currency', 3);
$table->timestamp('billed_at');
$table->timestamps();

$table->index(['billable_id', 'billable_type']);
});
}

Expand Down
Loading