There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
feat: refresh new workspace feature (#5834)
DarkSkyd665eaec3412
diff --git a/packages/backend/server/src/data/migrations/1708321519830-refresh-unlimited-workspace-feature.ts b/packages/backend/server/src/data/migrations/1708321519830-refresh-unlimited-workspace-feature.tsnew file mode 100644index 0000000000..347f90ded9--- /dev/null+++ b/packages/backend/server/src/data/migrations/1708321519830-refresh-unlimited-workspace-feature.ts@@ -0,0 +1,15 @@+import { PrismaClient } from '@prisma/client';++import { FeatureType } from '../../core/features';+import { upsertLatestFeatureVersion } from './utils/user-features';++export class RefreshUnlimitedWorkspaceFeature1708321519830 {+ // do the migration+ static async up(db: PrismaClient) {+ // add unlimited workspace feature+ await upsertLatestFeatureVersion(db, FeatureType.UnlimitedWorkspace);+ }++ // revert the migration+ static async down(_db: PrismaClient) {}+}diff --git a/packages/backend/server/src/data/migrations/utils/user-features.ts b/packages/backend/server/src/data/migrations/utils/user-features.tsindex 919d2b2195..35510e5547 100644--- a/packages/backend/server/src/data/migrations/utils/user-features.ts+++ b/packages/backend/server/src/data/migrations/utils/user-features.ts@@ -3,6 +3,7 @@ import { Prisma, PrismaClient } from '@prisma/client';import {CommonFeature,FeatureKind,+ Features,FeatureType,} from '../../../core/features';@@ -33,6 +34,16 @@ export async function upsertFeature(}}+export async function upsertLatestFeatureVersion(+ db: PrismaClient,+ type: FeatureType+) {+ const feature = Features.filter(f => f.feature === type);+ feature.sort((a, b) => b.version - a.version);+ const latestFeature = feature[0];+ await upsertFeature(db, latestFeature);+}+export async function migrateNewFeatureTable(prisma: PrismaClient) {const waitingList = await prisma.newFeaturesWaitingList.findMany();for (const oldUser of waitingList) {