Browse Source

feat: add description field to meta tables

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5540/head
Pranav C 2 years ago
parent
commit
b13715005f
  1. 4
      packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts
  2. 40
      packages/nocodb/src/lib/migrations/v2/nc_030_add_description_field.ts

4
packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts

@ -17,6 +17,7 @@ import * as nc_026_map_view from './v2/nc_026_map_view';
import * as nc_027_add_comparison_sub_op from './v2/nc_027_add_comparison_sub_op';
import * as nc_028_add_enable_scanner_in_form_columns_meta_table from './v2/nc_028_add_enable_scanner_in_form_columns_meta_table';
import * as nc_029_webhook from './v2/nc_029_webhook';
import * as nc_030_add_description_field from './v2/nc_030_add_description_field';
// Create a custom migration source class
export default class XcMigrationSourcev2 {
@ -45,6 +46,7 @@ export default class XcMigrationSourcev2 {
'nc_027_add_comparison_sub_op',
'nc_028_add_enable_scanner_in_form_columns_meta_table',
'nc_029_webhook',
'nc_030_add_description_field'
]);
}
@ -92,6 +94,8 @@ export default class XcMigrationSourcev2 {
return nc_028_add_enable_scanner_in_form_columns_meta_table;
case 'nc_029_webhook':
return nc_029_webhook;
case 'nc_030_add_description_field':
return nc_030_add_description_field;
}
}
}

40
packages/nocodb/src/lib/migrations/v2/nc_030_add_description_field.ts

@ -0,0 +1,40 @@
import { MetaTable } from '../../utils/globals';
import type { Knex } from 'knex';
const up = async (knex: Knex) => {
await knex.schema.alterTable(MetaTable.PROJECT, (table) => {
table.string('description', 255);
});
await knex.schema.alterTable(MetaTable.BASES, (table) => {
table.string('description', 255);
});
await knex.schema.alterTable(MetaTable.MODELS, (table) => {
table.string('description', 255);
});
await knex.schema.alterTable(MetaTable.VIEWS, (table) => {
table.string('description', 255);
});
await knex.schema.alterTable(MetaTable.COLUMNS, (table) => {
table.string('description', 255);
});
};
const down = async (knex) => {
await knex.schema.alterTable(MetaTable.PROJECT, (table) => {
table.dropColumn('description');
});
await knex.schema.alterTable(MetaTable.BASES, (table) => {
table.dropColumn('description');
});
await knex.schema.alterTable(MetaTable.MODELS, (table) => {
table.dropColumn('description');
});
await knex.schema.alterTable(MetaTable.VIEWS, (table) => {
table.dropColumn('description');
});
await knex.schema.alterTable(MetaTable.COLUMNS, (table) => {
table.dropColumn('description');
});
};
export { up, down };
Loading…
Cancel
Save