Browse Source

feat: add calendar view column in migration

pull/8281/head
Pranav C 9 months ago
parent
commit
a86939119c
  1. 22
      packages/nocodb/src/meta/migrations/v2/nc_041_view_column_index.ts

22
packages/nocodb/src/meta/migrations/v2/nc_041_view_column_index.ts

@ -2,22 +2,39 @@ import type { Knex } from 'knex';
import { MetaTable } from '~/utils/globals';
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) => {
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) => {
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) => {
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) => {
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) => {
await knex.schema.alterTable(MetaTable.GRID_VIEW_COLUMNS, (table) => {
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) => {
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 };

Loading…
Cancel
Save