mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
chore: bump version (#3606)
This commit is contained in:
28
packages/env/src/blocksuite/subdoc-migration.ts
vendored
28
packages/env/src/blocksuite/subdoc-migration.ts
vendored
@@ -1,6 +1,8 @@
|
||||
import type { Schema } from '@blocksuite/store';
|
||||
import * as Y from 'yjs';
|
||||
|
||||
type XYWH = [number, number, number, number];
|
||||
|
||||
function deserializeXYWH(xywh: string): XYWH {
|
||||
return JSON.parse(xywh) as XYWH;
|
||||
}
|
||||
@@ -240,14 +242,26 @@ export function migrateToSubdoc(doc: Y.Doc): Y.Doc {
|
||||
return output;
|
||||
}
|
||||
|
||||
export async function migrateDatabaseBlockTo3(doc: Y.Doc) {
|
||||
const { migratePageBlock } = await import(
|
||||
'@blocksuite/store/workspace/migration/migrate-block'
|
||||
);
|
||||
migratePageBlock(doc, {
|
||||
'affine:database': 2,
|
||||
export async function migrateDatabaseBlockTo3(rootDoc: Y.Doc, schema: Schema) {
|
||||
const spaces = rootDoc.getMap('spaces') as Y.Map<any>;
|
||||
spaces.forEach(space => {
|
||||
schema.upgradePage(
|
||||
{
|
||||
'affine:note': 1,
|
||||
'affine:bookmark': 1,
|
||||
'affine:database': 2,
|
||||
'affine:divider': 1,
|
||||
'affine:image': 1,
|
||||
'affine:list': 1,
|
||||
'affine:code': 1,
|
||||
'affine:page': 2,
|
||||
'affine:paragraph': 1,
|
||||
'affine:surface': 3,
|
||||
},
|
||||
space
|
||||
);
|
||||
});
|
||||
const meta = doc.getMap('meta') as Y.Map<unknown>;
|
||||
const meta = rootDoc.getMap('meta') as Y.Map<unknown>;
|
||||
const versions = meta.get('blockVersions') as Y.Map<number>;
|
||||
versions.set('affine:database', 3);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user