mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-25 20:50:14 -05:00
More fixing of plus server tier resolution (pass always correct seasonNth + for ongoing season use full tiers list)
This commit is contained in:
@@ -69,13 +69,18 @@ export function migrate(args: { newUserId: number; oldUserId: number }) {
|
||||
}
|
||||
|
||||
export function replacePlusTiers(
|
||||
plusTiers: Array<{ userId: number; tier: number }>,
|
||||
plusTiers: Array<{ userId: number; plusTier: number }>,
|
||||
) {
|
||||
invariant(plusTiers.length > 0, "plusTiers must not be empty");
|
||||
|
||||
return db.transaction().execute(async (trx) => {
|
||||
await trx.deleteFrom("PlusTier").execute();
|
||||
await trx.insertInto("PlusTier").values(plusTiers).execute();
|
||||
await trx
|
||||
.insertInto("PlusTier")
|
||||
.values(
|
||||
plusTiers.map(({ plusTier, userId }) => ({ userId, tier: plusTier })),
|
||||
)
|
||||
.execute();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user