Browse Source

feat: migration

pull/9807/head
Pranav C 2 months ago
parent
commit
af2e8c854d
  1. 8
      packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts
  2. 18
      packages/nocodb/src/meta/migrations/v2/nc_066_personal_view.ts
  3. 2
      packages/nocodb/src/models/View.ts

8
packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts

@ -52,6 +52,8 @@ import * as nc_062_integration_store from '~/meta/migrations/v2/nc_062_integrati
import * as nc_063_form_field_filter from '~/meta/migrations/v2/nc_063_form_field_filter';
import * as nc_064_pg_minimal_dbs from '~/meta/migrations/v2/nc_064_pg_minimal_dbs';
import * as nc_065_encrypt_flag from '~/meta/migrations/v2/nc_065_encrypt_flag';
import * as nc_066_ai_button from '~/meta/migrations/v2/nc_066_ai_button';
import * as nc_066_personal_view from '~/meta/migrations/v2/nc_066_personal_view';
// Create a custom migration source class
export default class XcMigrationSourcev2 {
@ -115,6 +117,8 @@ export default class XcMigrationSourcev2 {
'nc_063_form_field_filter',
'nc_064_pg_minimal_dbs',
'nc_065_encrypt_flag',
'nc_066_ai_button',
'nc_066_personal_view',
]);
}
@ -232,6 +236,10 @@ export default class XcMigrationSourcev2 {
return nc_064_pg_minimal_dbs;
case 'nc_065_encrypt_flag':
return nc_065_encrypt_flag;
case 'nc_066_ai_button':
return nc_066_ai_button;
case 'nc_066_personal_view':
return nc_066_personal_view;
}
}
}

18
packages/nocodb/src/meta/migrations/v2/nc_066_personal_view.ts

@ -0,0 +1,18 @@
import type { Knex } from 'knex';
import { MetaTable } from '~/utils/globals';
const up = async (knex: Knex) => {
await knex.schema.alterTable(MetaTable.VIEWS, (table) => {
table.boolean('is_personal').defaultTo(false);
table.boolean('created_by', 20).index();
});
};
const down = async (knex: Knex) => {
await knex.schema.alterTable(MetaTable.SOURCES, (table) => {
table.dropColumn('is_personal');
table.dropColumn('created_by');
});
};
export { up, down };

2
packages/nocodb/src/models/View.ts

@ -73,6 +73,8 @@ export default class View implements ViewType {
order: number;
type: ViewTypes;
lock_type?: ViewType['lock_type'];
created_by?: string;
is_personal?: string;
fk_model_id: string;
model?: Model;

Loading…
Cancel
Save