From 20f03d75fe55f69f12a2b35a40ee7d3bc56b5034 Mon Sep 17 00:00:00 2001 From: Simon Gardner Date: Fri, 5 Jun 2026 10:57:45 +0100 Subject: [PATCH] [web] Fix Stripe Subscription ID being saved to wrong field in admin panel (#34157) * [web] Fix Stripe Subscription ID being saved to wrong field in admin panel * add migration for unsetting recurlySubscription_id GitOrigin-RevId: ccae470897690a8cdc8a8bce883983808a963d24 --- ...ipe_subscription_id_from_recurly_field.mjs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tools/migrations/20260601160305_unset_stripe_subscription_id_from_recurly_field.mjs diff --git a/tools/migrations/20260601160305_unset_stripe_subscription_id_from_recurly_field.mjs b/tools/migrations/20260601160305_unset_stripe_subscription_id_from_recurly_field.mjs new file mode 100644 index 0000000000..e579d34af7 --- /dev/null +++ b/tools/migrations/20260601160305_unset_stripe_subscription_id_from_recurly_field.mjs @@ -0,0 +1,26 @@ +import { db } from './lib/mongodb.mjs' + +const tags = ['saas'] + +const migrate = async () => { + const result = await db.subscriptions.updateMany( + { + recurlySubscription_id: /^sub_/, + $expr: { + $eq: ['$recurlySubscription_id', '$paymentProvider.subscriptionId'], + }, + }, + { $unset: { recurlySubscription_id: '' } } + ) + console.log( + `Updated ${result.modifiedCount} subscriptions (matched ${result.matchedCount}).` + ) +} + +const rollback = async () => {} + +export default { + tags, + migrate, + rollback, +}