mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
[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:
@@ -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,
|
||||
}
|
||||
Reference in New Issue
Block a user