diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php index 9f9b61a5..32422a9a 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -29,10 +29,6 @@ public function up(): void $table->text('two_factor_secret')->nullable(); $table->text('two_factor_recovery_codes')->nullable(); $table->timestamp('two_factor_confirmed_at')->nullable(); - $table->string('stripe_id')->nullable()->index(); - $table->string('pm_type')->nullable(); - $table->string('pm_last_four', 4)->nullable(); - $table->timestamp('trial_ends_at')->nullable(); $table->rememberToken(); $table->string('setup')->nullable(); $table->string('persona')->nullable(); diff --git a/database/migrations/2026_04_14_204912_create_plans_table.php b/database/migrations/2026_01_14_231039_create_plans_table.php similarity index 100% rename from database/migrations/2026_04_14_204912_create_plans_table.php rename to database/migrations/2026_01_14_231039_create_plans_table.php diff --git a/database/migrations/2026_01_14_232315_create_workspaces_table.php b/database/migrations/2026_01_14_232315_create_workspaces_table.php index 516ce6f6..ffd14a90 100644 --- a/database/migrations/2026_01_14_232315_create_workspaces_table.php +++ b/database/migrations/2026_01_14_232315_create_workspaces_table.php @@ -16,8 +16,13 @@ public function up(): void Schema::create('workspaces', function (Blueprint $table) { $table->uuid('id')->primary(); $table->uuid('user_id'); + $table->foreignUuid('plan_id')->nullable()->constrained()->nullOnDelete(); $table->string('name'); $table->string('timezone'); + $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('user_id')->references('id')->on('users')->cascadeOnDelete(); diff --git a/database/migrations/2026_04_14_205939_create_brands_table.php b/database/migrations/2026_01_14_232316_create_brands_table.php similarity index 100% rename from database/migrations/2026_04_14_205939_create_brands_table.php rename to database/migrations/2026_01_14_232316_create_brands_table.php diff --git a/database/migrations/2026_01_14_231040_create_subscriptions_table.php b/database/migrations/2026_01_14_232317_create_subscriptions_table.php similarity index 86% rename from database/migrations/2026_01_14_231040_create_subscriptions_table.php rename to database/migrations/2026_01_14_232317_create_subscriptions_table.php index 52f956a0..929e97d1 100644 --- a/database/migrations/2026_01_14_231040_create_subscriptions_table.php +++ b/database/migrations/2026_01_14_232317_create_subscriptions_table.php @@ -15,7 +15,7 @@ public function up(): void { Schema::create('subscriptions', function (Blueprint $table) { $table->uuid('id')->primary(); - $table->foreignUuid('user_id')->constrained()->cascadeOnDelete(); + $table->foreignUuid('workspace_id')->constrained()->cascadeOnDelete(); $table->string('type'); $table->string('stripe_id')->unique(); $table->string('stripe_status'); @@ -25,7 +25,7 @@ public function up(): void $table->timestamp('ends_at')->nullable(); $table->timestamps(); - $table->index(['user_id', 'stripe_status']); + $table->index(['workspace_id', 'stripe_status']); }); } diff --git a/database/migrations/2026_01_14_231041_create_subscription_items_table.php b/database/migrations/2026_01_14_232318_create_subscription_items_table.php similarity index 100% rename from database/migrations/2026_01_14_231041_create_subscription_items_table.php rename to database/migrations/2026_01_14_232318_create_subscription_items_table.php diff --git a/database/migrations/2026_01_14_232316_create_user_workspace_table.php b/database/migrations/2026_01_14_232319_create_user_workspace_table.php similarity index 100% rename from database/migrations/2026_01_14_232316_create_user_workspace_table.php rename to database/migrations/2026_01_14_232319_create_user_workspace_table.php diff --git a/database/migrations/2026_01_14_232317_create_social_accounts_table.php b/database/migrations/2026_01_14_232320_create_social_accounts_table.php similarity index 94% rename from database/migrations/2026_01_14_232317_create_social_accounts_table.php rename to database/migrations/2026_01_14_232320_create_social_accounts_table.php index d18d43d4..455f105b 100644 --- a/database/migrations/2026_01_14_232317_create_social_accounts_table.php +++ b/database/migrations/2026_01_14_232320_create_social_accounts_table.php @@ -16,6 +16,7 @@ public function up(): void Schema::create('social_accounts', function (Blueprint $table) { $table->uuid('id')->primary(); $table->uuid('workspace_id'); + $table->foreignUuid('brand_id')->nullable()->constrained()->nullOnDelete(); $table->string('platform'); $table->string('platform_user_id'); $table->string('username')->nullable(); diff --git a/database/migrations/2026_01_14_232318_create_posts_table.php b/database/migrations/2026_01_14_232321_create_posts_table.php similarity index 100% rename from database/migrations/2026_01_14_232318_create_posts_table.php rename to database/migrations/2026_01_14_232321_create_posts_table.php diff --git a/database/migrations/2026_01_14_232319_create_post_platforms_table.php b/database/migrations/2026_01_14_232322_create_post_platforms_table.php similarity index 100% rename from database/migrations/2026_01_14_232319_create_post_platforms_table.php rename to database/migrations/2026_01_14_232322_create_post_platforms_table.php diff --git a/database/migrations/2026_01_14_232320_create_medias_table.php b/database/migrations/2026_01_14_232323_create_medias_table.php similarity index 100% rename from database/migrations/2026_01_14_232320_create_medias_table.php rename to database/migrations/2026_01_14_232323_create_medias_table.php diff --git a/database/migrations/2026_04_14_205940_add_brand_id_to_social_accounts_table.php b/database/migrations/2026_04_14_205940_add_brand_id_to_social_accounts_table.php deleted file mode 100644 index 99327085..00000000 --- a/database/migrations/2026_04_14_205940_add_brand_id_to_social_accounts_table.php +++ /dev/null @@ -1,24 +0,0 @@ -foreignUuid('brand_id')->nullable()->after('workspace_id')->constrained()->nullOnDelete(); - }); - } - - public function down(): void - { - Schema::table('social_accounts', function (Blueprint $table) { - $table->dropConstrainedForeignId('brand_id'); - }); - } -}; diff --git a/database/migrations/2026_04_14_205940_add_plan_id_to_workspaces_table.php b/database/migrations/2026_04_14_205940_add_plan_id_to_workspaces_table.php deleted file mode 100644 index f3b121ae..00000000 --- a/database/migrations/2026_04_14_205940_add_plan_id_to_workspaces_table.php +++ /dev/null @@ -1,24 +0,0 @@ -foreignUuid('plan_id')->nullable()->after('user_id')->constrained()->nullOnDelete(); - }); - } - - public function down(): void - { - Schema::table('workspaces', function (Blueprint $table) { - $table->dropConstrainedForeignId('plan_id'); - }); - } -}; diff --git a/database/migrations/2026_04_14_210719_add_billing_columns_to_workspaces_table.php b/database/migrations/2026_04_14_210719_add_billing_columns_to_workspaces_table.php deleted file mode 100644 index 183225be..00000000 --- a/database/migrations/2026_04_14_210719_add_billing_columns_to_workspaces_table.php +++ /dev/null @@ -1,34 +0,0 @@ -string('stripe_id')->nullable()->after('plan_id')->index(); - $table->string('pm_type')->nullable()->after('stripe_id'); - $table->string('pm_last_four')->nullable()->after('pm_type'); - $table->timestamp('trial_ends_at')->nullable()->after('pm_last_four'); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::table('workspaces', function (Blueprint $table) { - $table->dropIndex(['stripe_id']); - $table->dropColumn(['stripe_id', 'pm_type', 'pm_last_four', 'trial_ends_at']); - }); - } -}; diff --git a/database/migrations/2026_04_14_210720_migrate_subscriptions_to_workspace.php b/database/migrations/2026_04_14_210720_migrate_subscriptions_to_workspace.php deleted file mode 100644 index 7b4238cb..00000000 --- a/database/migrations/2026_04_14_210720_migrate_subscriptions_to_workspace.php +++ /dev/null @@ -1,44 +0,0 @@ -dropIndex(['user_id', 'stripe_status']); - $table->dropForeign(['user_id']); - $table->dropColumn('user_id'); - }); - - Schema::table('subscriptions', function (Blueprint $table) { - $table->foreignUuid('workspace_id')->after('id')->constrained()->cascadeOnDelete(); - $table->index(['workspace_id', 'stripe_status']); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::table('subscriptions', function (Blueprint $table) { - $table->dropIndex(['workspace_id', 'stripe_status']); - $table->dropForeign(['workspace_id']); - $table->dropColumn('workspace_id'); - }); - - Schema::table('subscriptions', function (Blueprint $table) { - $table->foreignUuid('user_id')->after('id')->constrained()->cascadeOnDelete(); - $table->index(['user_id', 'stripe_status']); - }); - } -}; diff --git a/database/migrations/2026_04_14_210720_remove_billing_columns_from_users_table.php b/database/migrations/2026_04_14_210720_remove_billing_columns_from_users_table.php deleted file mode 100644 index 3c3cdeba..00000000 --- a/database/migrations/2026_04_14_210720_remove_billing_columns_from_users_table.php +++ /dev/null @@ -1,34 +0,0 @@ -dropIndex(['stripe_id']); - $table->dropColumn(['stripe_id', 'pm_type', 'pm_last_four', 'trial_ends_at']); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::table('users', function (Blueprint $table) { - $table->string('stripe_id')->nullable()->index(); - $table->string('pm_type')->nullable(); - $table->string('pm_last_four', 4)->nullable(); - $table->timestamp('trial_ends_at')->nullable(); - }); - } -};