trypost/database/migrations/2026_01_14_231040_create_accounts_table.php
Paulo Castellano ded1c998ec feat: redesign billing, onboarding, sidebar, and settings architecture
- Sidebar reorganized: Workspace group (connections, hashtags, labels,
  API keys, settings) and Account group (settings, usage, billing)
- Account group only visible to owner and hidden in self-hosted mode
- Onboarding simplified: role -> account (connect socials) -> completed
  -> redirect to /subscribe. Removed Subscription setup step.
- Subscribe page redesigned with 4 plan cards, monthly/yearly toggle,
  trial info, and per-plan features list
- Billing page redesigned following Sendkit layout (sections with
  sidebar labels)
- Processing page uses usePoll with immediate watch for subscription
  activation
- Cancel URL redirects directly to /subscribe
- Account settings page with name and billing_email (syncs with Stripe)
- Usage page with ring meters for all plan limits
- Settings layout tabs only for user pages (profile, password,
  notifications). Workspace/API keys/billing are standalone pages.
- GoogleAuthButton extracted as reusable component
- WorkspaceRole TypeScript enum for type-safe role checks in frontend
- Trial period changed to 7 days
- Fixed onboarding loop when user confirms email
- All 1101 tests passing
2026-04-15 00:33:38 -03:00

38 lines
1.2 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
{
public function up(): void
{
Schema::create('accounts', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->uuid('owner_id')->nullable();
$table->string('name');
$table->string('billing_email')->nullable();
$table->foreignUuid('plan_id')->nullable()->constrained()->nullOnDelete();
$table->string('stripe_id')->nullable()->index();
$table->string('pm_type')->nullable();
$table->string('pm_last_four')->nullable();
$table->timestamp('trial_ends_at')->nullable();
$table->timestamps();
$table->foreign('owner_id')->references('id')->on('users')->nullOnDelete();
});
// Add FK constraint for users.account_id -> accounts.id
Schema::table('users', function (Blueprint $table) {
$table->foreign('account_id')->references('id')->on('accounts')->nullOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('accounts');
}
};