-- Add plugin and plugin_limits columns to subscription_tiers
ALTER TABLE "subscription_tiers" ADD COLUMN "plugin" VARCHAR(30) NOT NULL DEFAULT 'translate';
ALTER TABLE "subscription_tiers" ADD COLUMN "plugin_limits" JSONB NOT NULL DEFAULT '{}';

-- Drop old unique index on slug alone
DROP INDEX IF EXISTS "subscription_tiers_slug_key";

-- Add compound unique on (plugin, slug)
CREATE UNIQUE INDEX "subscription_tiers_plugin_slug_key" ON "subscription_tiers"("plugin", "slug");

-- Drop old composite index
DROP INDEX IF EXISTS "subscription_tiers_is_active_display_order_idx";

-- Add new composite index including plugin
CREATE INDEX "subscription_tiers_plugin_is_active_display_order_idx" ON "subscription_tiers"("plugin", "is_active", "display_order");
