fix 0001 migration: skip rename if columns already renamed
Production DB had already been migrated by the manual script, so the old lemonsqueezy columns no longer exist. Check column names before attempting the rename. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,13 +2,16 @@
|
||||
|
||||
|
||||
def up(conn):
|
||||
cols = {r[1] for r in conn.execute("PRAGMA table_info(subscriptions)")}
|
||||
if "lemonsqueezy_customer_id" in cols:
|
||||
conn.execute(
|
||||
"ALTER TABLE subscriptions"
|
||||
" RENAME COLUMN lemonsqueezy_customer_id TO paddle_customer_id"
|
||||
)
|
||||
conn.execute(
|
||||
"ALTER TABLE subscriptions"
|
||||
" RENAME COLUMN lemonsqueezy_subscription_id TO paddle_subscription_id"
|
||||
" RENAME COLUMN lemonsqueezy_subscription_id"
|
||||
" TO paddle_subscription_id"
|
||||
)
|
||||
conn.execute("DROP INDEX IF EXISTS idx_subscriptions_provider")
|
||||
conn.execute(
|
||||
|
||||
Reference in New Issue
Block a user