Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

Improve node references migration

Hakan Shehu71be5f6e3e83
diff --git a/apps/desktop/src/main/databases/workspace/migrations/00018-create-node-references-table.ts b/apps/desktop/src/main/databases/workspace/migrations/00018-create-node-references-table.ts
index 0b7e1624..7d8684b6 100644
--- a/apps/desktop/src/main/databases/workspace/migrations/00018-create-node-references-table.ts
+++ b/apps/desktop/src/main/databases/workspace/migrations/00018-create-node-references-table.ts
@@ -12,7 +12,17 @@ export const createNodeReferencesTable: Migration = {
.addColumn('type', 'text', (col) => col.notNull())
.addColumn('created_at', 'text', (col) => col.notNull())
.addColumn('created_by', 'text', (col) => col.notNull())
- .addPrimaryKeyConstraint('node_references_pkey', ['node_id', 'type'])
+ .addPrimaryKeyConstraint('node_references_pkey', [
+ 'node_id',
+ 'reference_id',
+ 'inner_id',
+ ])
+ .execute();
+
+ await db.schema
+ .createIndex('node_references_reference_id_idx')
+ .on('node_references')
+ .column('reference_id')
.execute();
},
down: async (db) => {