[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
This commit is contained in:
Simon Gardner
2026-06-08 08:06:10 +00:00
committed by Copybot
parent c8a3bdd13f
commit 20f03d75fe
@@ -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,
}