chore(server): standardize server db names and columns (#7674)

This commit is contained in:
forehalo
2024-07-31 07:59:22 +00:00
parent c6d4985cba
commit 4ec89ebd69
15 changed files with 276 additions and 459 deletions

View File

@@ -15,7 +15,7 @@ export async function upgradeQuotaVersion(
// migrate all users that using old quota to new quota
await db.$transaction(
async tx => {
const latestQuotaVersion = await tx.features.findFirstOrThrow({
const latestQuotaVersion = await tx.feature.findFirstOrThrow({
where: { feature: quota.feature },
orderBy: { version: 'desc' },
select: { id: true },
@@ -39,7 +39,7 @@ export async function upgradeQuotaVersion(
});
// deactivate all old quota for the user
await tx.userFeatures.updateMany({
await tx.userFeature.updateMany({
where: {
id: undefined,
userId: {
@@ -55,7 +55,7 @@ export async function upgradeQuotaVersion(
},
});
await tx.userFeatures.createMany({
await tx.userFeature.createMany({
data: userIds.map(({ id: userId }) => ({
userId,
featureId: latestQuotaVersion.id,