From aa46429408945eff207c4fde535c2ee5b11f3d3a Mon Sep 17 00:00:00 2001 From: mertmit Date: Thu, 15 Feb 2024 09:15:04 +0000 Subject: [PATCH] fix: add skipped migrations for sqlite3 as they're supported now --- .../meta/migrations/XcMigrationSourcev2.ts | 4 + .../v2/nc_039_sqlite_alter_column_types.ts | 88 +++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 packages/nocodb/src/meta/migrations/v2/nc_039_sqlite_alter_column_types.ts diff --git a/packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts b/packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts index 643f5c4d0a..0697a65891 100644 --- a/packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts +++ b/packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts @@ -25,6 +25,7 @@ import * as nc_035_add_username_to_users from '~/meta/migrations/v2/nc_035_add_u import * as nc_036_base_deleted from '~/meta/migrations/v2/nc_036_base_deleted'; import * as nc_037_rename_project_and_base from '~/meta/migrations/v2/nc_037_rename_project_and_base'; import * as nc_038_formula_parsed_tree_column from '~/meta/migrations/v2/nc_038_formula_parsed_tree_column'; +import * as nc_039_sqlite_alter_column_types from '~/meta/migrations/v2/nc_039_sqlite_alter_column_types'; // Create a custom migration source class export default class XcMigrationSourcev2 { @@ -61,6 +62,7 @@ export default class XcMigrationSourcev2 { 'nc_036_base_deleted', 'nc_037_rename_project_and_base', 'nc_038_formula_parsed_tree_column', + 'nc_039_sqlite_alter_column_types', ]); } @@ -124,6 +126,8 @@ export default class XcMigrationSourcev2 { return nc_037_rename_project_and_base; case 'nc_038_formula_parsed_tree_column': return nc_038_formula_parsed_tree_column; + case 'nc_039_sqlite_alter_column_types': + return nc_039_sqlite_alter_column_types; } } } diff --git a/packages/nocodb/src/meta/migrations/v2/nc_039_sqlite_alter_column_types.ts b/packages/nocodb/src/meta/migrations/v2/nc_039_sqlite_alter_column_types.ts new file mode 100644 index 0000000000..e4ee281439 --- /dev/null +++ b/packages/nocodb/src/meta/migrations/v2/nc_039_sqlite_alter_column_types.ts @@ -0,0 +1,88 @@ +import type { Knex } from 'knex'; +import { MetaTable } from '~/utils/globals'; + +const up = async (knex: Knex) => { + if (knex.client.config.client === 'sqlite3') { + //nc_012_alter_colum_data_types.ts + await knex.schema.alterTable(MetaTable.COLUMNS, (table) => { + table.text('cdf').alter(); + }); + await knex.schema.alterTable(MetaTable.COLUMNS, (table) => { + table.text('dtxp').alter(); + }); + await knex.schema.alterTable(MetaTable.COLUMNS, (table) => { + table.text('cc').alter(); + }); + await knex.schema.alterTable(MetaTable.COLUMNS, (table) => { + table.text('ct').alter(); + }); + //nc_014_alter_colum_data_types.ts + await knex.schema.alterTable(MetaTable.FORM_VIEW, (table) => { + table.text('success_msg').alter(); + }); + await knex.schema.alterTable(MetaTable.FORM_VIEW, (table) => { + table.text('redirect_url').alter(); + }); + await knex.schema.alterTable(MetaTable.FORM_VIEW, (table) => { + table.text('banner_image_url').alter(); + }); + await knex.schema.alterTable(MetaTable.FORM_VIEW, (table) => { + table.text('logo_url').alter(); + }); + await knex.schema.alterTable(MetaTable.FORM_VIEW_COLUMNS, (table) => { + table.text('description').alter(); + }); + //nc_016_alter_hooklog_payload_types.ts + await knex.schema.alterTable(MetaTable.HOOK_LOGS, (table) => { + table.text('payload').alter(); + }); + //nc_029_webhook.ts + await knex.schema.alterTable(MetaTable.HOOK_LOGS, (table) => { + table.text('response').alter(); + }); + } +}; + +const down = async (knex) => { + if (knex.client.config.client === 'sqlite3') { + //nc_012_alter_colum_data_types.ts + await knex.schema.alterTable(MetaTable.COLUMNS, (table) => { + table.string('cdf').alter(); + }); + await knex.schema.alterTable(MetaTable.COLUMNS, (table) => { + table.string('dtxp').alter(); + }); + await knex.schema.alterTable(MetaTable.COLUMNS, (table) => { + table.string('cc').alter(); + }); + await knex.schema.alterTable(MetaTable.COLUMNS, (table) => { + table.string('ct').alter(); + }); + //nc_014_alter_colum_data_types.ts + await knex.schema.alterTable(MetaTable.FORM_VIEW, (table) => { + table.string('success_msg').alter(); + }); + await knex.schema.alterTable(MetaTable.FORM_VIEW, (table) => { + table.string('redirect_url').alter(); + }); + await knex.schema.alterTable(MetaTable.FORM_VIEW, (table) => { + table.string('banner_image_url').alter(); + }); + await knex.schema.alterTable(MetaTable.FORM_VIEW, (table) => { + table.string('logo_url').alter(); + }); + await knex.schema.alterTable(MetaTable.FORM_VIEW_COLUMNS, (table) => { + table.string('description').alter(); + }); + //nc_016_alter_hooklog_payload_types.ts + await knex.schema.alterTable(MetaTable.HOOK_LOGS, (table) => { + table.boolean('payload').alter(); + }); + //nc_029_webhook.ts + await knex.schema.alterTable(MetaTable.HOOK_LOGS, (table) => { + table.boolean('response').alter(); + }); + } +}; + +export { up, down };