- Create Account model as Cashier Billable entity (stripe, plan, subscription) - Account owns workspaces and has an owner_id (User) - User belongs to one Account via account_id - Workspace belongs to Account via account_id, no longer has billing fields - Remove Brand model entirely (workspaces serve as grouping) - Rename brand_limit to workspace_limit in plans - Workspace roles simplified: admin/member/viewer (owner via Account) - Invites now belong to Account with workspaces JSON array - Pennant features scope changed from Workspace to Account - EnsureSubscribed middleware checks Account subscription - All controllers updated: BillingController, OnboardingController, WorkspaceInviteController, SocialController, StripeEventListener - Frontend: extract GoogleAuthButton component, create WorkspaceRole enum for type-safe role checks, fix all views for new architecture - All 1101 tests passing
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
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('subscriptions', function (Blueprint $table) {
|
|
$table->uuid('id')->primary();
|
|
$table->foreignUuid('account_id')->constrained()->cascadeOnDelete();
|
|
$table->string('type');
|
|
$table->string('stripe_id')->unique();
|
|
$table->string('stripe_status');
|
|
$table->string('stripe_price')->nullable();
|
|
$table->integer('quantity')->nullable();
|
|
$table->timestamp('trial_ends_at')->nullable();
|
|
$table->timestamp('ends_at')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->index(['account_id', 'stripe_status']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('subscriptions');
|
|
}
|
|
};
|