Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

refactor: consolidate billing migrations into original files

Paulo Castellano42d5adeb1a57
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 9f9b61a52..32422a9ab 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 @@ return new class extends Migration
$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 516ce6f6e..ffd14a905 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 @@ return new class extends Migration
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 52f956a0e..929e97d13 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 @@ return new class extends Migration
{
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 @@ return new class extends Migration
$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 d18d43d47..455f105b5 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 @@ return new class extends Migration
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 99327085a..000000000
--- a/database/migrations/2026_04_14_205940_add_brand_id_to_social_accounts_table.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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::table('social_accounts', function (Blueprint $table) {
- $table->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 f3b121ae4..000000000
--- a/database/migrations/2026_04_14_205940_add_plan_id_to_workspaces_table.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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::table('workspaces', function (Blueprint $table) {
- $table->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 183225beb..000000000
--- a/database/migrations/2026_04_14_210719_add_billing_columns_to_workspaces_table.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?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::table('workspaces', function (Blueprint $table) {
- $table->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 7b4238cbb..000000000
--- a/database/migrations/2026_04_14_210720_migrate_subscriptions_to_workspace.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?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::table('subscriptions', function (Blueprint $table) {
- $table->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 3c3cdeba6..000000000
--- a/database/migrations/2026_04_14_210720_remove_billing_columns_from_users_table.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?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::table('users', function (Blueprint $table) {
- $table->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();
- });
- }
-};