mirror of
https://github.com/colanode/colanode.git
synced 2025-12-24 23:49:27 +01:00
Add indexes in node_paths and users tables
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { Migration } from 'kysely';
|
||||
|
||||
export const createNodePathsIndexes: Migration = {
|
||||
up: async (db) => {
|
||||
await db.schema
|
||||
.createIndex('node_paths_ancestor_id_idx')
|
||||
.on('node_paths')
|
||||
.column('ancestor_id')
|
||||
.execute();
|
||||
|
||||
await db.schema
|
||||
.createIndex('node_paths_descendant_id_idx')
|
||||
.on('node_paths')
|
||||
.column('descendant_id')
|
||||
.execute();
|
||||
},
|
||||
down: async (db) => {
|
||||
await db.schema.dropIndex('node_paths_ancestor_id_idx').execute();
|
||||
await db.schema.dropIndex('node_paths_descendant_id_idx').execute();
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Migration } from 'kysely';
|
||||
|
||||
export const createUserAccountIdIndex: Migration = {
|
||||
up: async (db) => {
|
||||
await db.schema
|
||||
.createIndex('users_account_id_idx')
|
||||
.on('users')
|
||||
.columns(['account_id'])
|
||||
.execute();
|
||||
},
|
||||
down: async (db) => {
|
||||
await db.schema.dropIndex('users_account_id_idx').execute();
|
||||
},
|
||||
};
|
||||
@@ -14,6 +14,8 @@ import { createCollaborationsTable } from './00011-create-collaborations-table';
|
||||
import { createDocumentsTable } from './00012-create-documents-table';
|
||||
import { createDocumentUpdatesTable } from './00013-create-document-updates-table';
|
||||
import { createUploadsTable } from './00014-create-uploads-table';
|
||||
import { createNodePathsIndexes } from './00015-create-node-paths-indexes';
|
||||
import { createUserAccountIdIndex } from './00016-create-user-account-id-index';
|
||||
|
||||
export const databaseMigrations: Record<string, Migration> = {
|
||||
'00001_create_accounts_table': createAccountsTable,
|
||||
@@ -30,4 +32,6 @@ export const databaseMigrations: Record<string, Migration> = {
|
||||
'00012_create_documents_table': createDocumentsTable,
|
||||
'00013_create_document_updates_table': createDocumentUpdatesTable,
|
||||
'00014_create_uploads_table': createUploadsTable,
|
||||
'00015_create_node_paths_indexes': createNodePathsIndexes,
|
||||
'00016_create_user_account_id_index': createUserAccountIdIndex,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user