Browse Source

feat: add index from view columns - WIP

pull/8281/head
Pranav C 7 months ago
parent
commit
7fe3ebc53f
  1. 35
      packages/nocodb/src/meta/migrations/v2/nc_041_view_column_index.ts

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

@ -0,0 +1,35 @@
import type { Knex } from 'knex';
import { MetaTable } from '~/utils/globals';
const up = async (knex: Knex) => {
await knex.schema.alterTable(MetaTable.GRID_VIEW_COLUMNS, (table) => {
table.index(['fk_model_id', 'fk_column_id']);
});
await knex.schema.alterTable(MetaTable.GALLERY_VIEW_COLUMNS, (table) => {
table.index(['fk_model_id', 'fk_column_id']);
});
await knex.schema.alterTable(MetaTable.KANBAN_VIEW_COLUMNS, (table) => {
table.index(['fk_model_id', 'fk_column_id']);
});
await knex.schema.alterTable(MetaTable.FORM_VIEW_COLUMNS, (table) => {
table.index(['fk_model_id', 'fk_column_id']);
});
};
const down = async (knex: Knex) => {
await knex.schema.alterTable(MetaTable.GRID_VIEW_COLUMNS, (table) => {
table.dropIndex(['fk_model_id', 'fk_column_id']);
});
await knex.schema.alterTable(MetaTable.GALLERY_VIEW_COLUMNS, (table) => {
table.dropIndex(['fk_model_id', 'fk_column_id']);
});
await knex.schema.alterTable(MetaTable.KANBAN_VIEW_COLUMNS, (table) => {
table.dropIndex(['fk_model_id', 'fk_column_id']);
});
await knex.schema.alterTable(MetaTable.FORM_VIEW_COLUMNS, (table) => {
table.dropIndex(['fk_model_id', 'fk_column_id']);
});
};
export { up, down };
Loading…
Cancel
Save