|
|
@ -2,22 +2,39 @@ import type { Knex } from 'knex'; |
|
|
|
import { MetaTable } from '~/utils/globals'; |
|
|
|
import { MetaTable } from '~/utils/globals'; |
|
|
|
|
|
|
|
|
|
|
|
const up = async (knex: Knex) => { |
|
|
|
const up = async (knex: Knex) => { |
|
|
|
|
|
|
|
console.log('Adding index to view column tables...'); |
|
|
|
|
|
|
|
console.time('Added index to Grid view columns'); |
|
|
|
await knex.schema.alterTable(MetaTable.GRID_VIEW_COLUMNS, (table) => { |
|
|
|
await knex.schema.alterTable(MetaTable.GRID_VIEW_COLUMNS, (table) => { |
|
|
|
table.index(['fk_model_id', 'fk_column_id']); |
|
|
|
table.index(['fk_model_id', 'fk_column_id']); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
console.timeEnd('Added index to Grid view columns'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.time('Added index to Gallery view columns'); |
|
|
|
await knex.schema.alterTable(MetaTable.GALLERY_VIEW_COLUMNS, (table) => { |
|
|
|
await knex.schema.alterTable(MetaTable.GALLERY_VIEW_COLUMNS, (table) => { |
|
|
|
table.index(['fk_model_id', 'fk_column_id']); |
|
|
|
table.index(['fk_model_id', 'fk_column_id']); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
console.timeEnd('Added index to Gallery view columns'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.time('Added index to Kanban view columns'); |
|
|
|
await knex.schema.alterTable(MetaTable.KANBAN_VIEW_COLUMNS, (table) => { |
|
|
|
await knex.schema.alterTable(MetaTable.KANBAN_VIEW_COLUMNS, (table) => { |
|
|
|
table.index(['fk_model_id', 'fk_column_id']); |
|
|
|
table.index(['fk_model_id', 'fk_column_id']); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
console.timeEnd('Added index to Kanban view columns'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.time('Added index to Form view columns'); |
|
|
|
await knex.schema.alterTable(MetaTable.FORM_VIEW_COLUMNS, (table) => { |
|
|
|
await knex.schema.alterTable(MetaTable.FORM_VIEW_COLUMNS, (table) => { |
|
|
|
table.index(['fk_model_id', 'fk_column_id']); |
|
|
|
table.index(['fk_model_id', 'fk_column_id']); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
console.timeEnd('Added index to Form view columns'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.time('Added index to Calendar view columns'); |
|
|
|
|
|
|
|
await knex.schema.alterTable(MetaTable.CALENDAR_VIEW_COLUMNS, (table) => { |
|
|
|
|
|
|
|
table.index(['fk_model_id', 'fk_column_id']); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
console.timeEnd('Added index to Calendar view columns'); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const down = async (knex: Knex) => { |
|
|
|
const down = async (knex: Knex) => { |
|
|
|
|
|
|
|
|
|
|
|
await knex.schema.alterTable(MetaTable.GRID_VIEW_COLUMNS, (table) => { |
|
|
|
await knex.schema.alterTable(MetaTable.GRID_VIEW_COLUMNS, (table) => { |
|
|
|
table.dropIndex(['fk_model_id', 'fk_column_id']); |
|
|
|
table.dropIndex(['fk_model_id', 'fk_column_id']); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -30,6 +47,9 @@ const down = async (knex: Knex) => { |
|
|
|
await knex.schema.alterTable(MetaTable.FORM_VIEW_COLUMNS, (table) => { |
|
|
|
await knex.schema.alterTable(MetaTable.FORM_VIEW_COLUMNS, (table) => { |
|
|
|
table.dropIndex(['fk_model_id', 'fk_column_id']); |
|
|
|
table.dropIndex(['fk_model_id', 'fk_column_id']); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
await knex.schema.alterTable(MetaTable.CALENDAR_VIEW_COLUMNS, (table) => { |
|
|
|
|
|
|
|
table.dropIndex(['fk_model_id', 'fk_column_id']); |
|
|
|
|
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export { up, down }; |
|
|
|
export { up, down }; |
|
|
|