π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix: migration issues
Ramesh Mane31662ced820e
diff --git a/packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts b/packages/nocodb/src/meta/migrations/XcMigrationSourcev2.tsindex 9aa504ac46..222d70b409 100644--- a/packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts+++ b/packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts@@ -86,9 +86,6 @@ import * as nc_094_add_meta_to_filter_exp_v2 from '~/meta/migrations/v2/nc_094_aimport * as nc_096_deprecate_unused from '~/meta/migrations/v2/nc_096_deprecate_unused';import * as nc_097_unify_schema from '~/meta/migrations/v2/nc_097_unify_schema';import * as nc_098_default_workspace from '~/meta/migrations/v2/nc_098_default_workspace';-import * as nc_099_record_templates from '~/meta/migrations/v2/nc_099_record_templates';-import * as nc_100_record_templates_enabled from '~/meta/migrations/v2/nc_100_record_templates_enabled';-// Create a custom migration source classexport default class XcMigrationSourcev2 {// Must return a Promise containing a list of migrations.@@ -183,8 +180,6 @@ export default class XcMigrationSourcev2 {'nc_096_deprecate_unused','nc_097_unify_schema','nc_098_default_workspace',- 'nc_099_record_templates',- 'nc_100_record_templates_enabled',]);}@@ -366,10 +361,6 @@ export default class XcMigrationSourcev2 {return nc_097_unify_schema;case 'nc_098_default_workspace':return nc_098_default_workspace;- case 'nc_099_record_templates':- return nc_099_record_templates;- case 'nc_100_record_templates_enabled':- return nc_100_record_templates_enabled;}}}diff --git a/packages/nocodb/src/meta/migrations/v0/nc_021_record_templates.ts b/packages/nocodb/src/meta/migrations/v0/nc_021_record_templates.tsindex 6544ad4d5c..0187b97d9b 100644--- a/packages/nocodb/src/meta/migrations/v0/nc_021_record_templates.ts+++ b/packages/nocodb/src/meta/migrations/v0/nc_021_record_templates.ts@@ -12,6 +12,7 @@ const up = async (knex: Knex) => {table.text('description');table.text('template_data').notNullable();table.integer('usage_count').defaultTo(0);+ table.boolean('enabled').defaultTo(true);table.string('created_by', 20);table.timestamps(true, true);table.primary(['base_id', 'id']);diff --git a/packages/nocodb/src/meta/migrations/v2/nc_099_record_templates.ts b/packages/nocodb/src/meta/migrations/v2/nc_099_record_templates.tsindex 96aebc8f37..5799be9186 100644--- a/packages/nocodb/src/meta/migrations/v2/nc_099_record_templates.ts+++ b/packages/nocodb/src/meta/migrations/v2/nc_099_record_templates.ts@@ -1,32 +1,16 @@+/**+ * DEPRECATED: This migration has been consolidated into v0/nc_018_record_templates.+ * All new migrations should be added to XcMigrationSourcev0.+ * This file is kept only because the filesystem does not allow deletion.+ */import type { Knex } from 'knex';-import { MetaTable } from '~/utils/globals';-const up = async (knex: Knex) => {- if (!(await knex.schema.hasTable(MetaTable.RECORD_TEMPLATES))) {- await knex.schema.createTable(MetaTable.RECORD_TEMPLATES, (table) => {- table.string('id', 20).primary();- table.string('base_id', 20).notNullable();- table.string('fk_workspace_id', 20);- table.string('source_id', 20).notNullable();- table.string('title', 255).notNullable();- table.text('description');- table.text('template_data', 'longtext').notNullable();- table.integer('usage_count').defaultTo(0);- table.boolean('enabled').defaultTo(true);- table.string('created_by', 20);- table.timestamps(true, true);-- // Indexes- table.index('base_id');- table.index('source_id');- table.index(['base_id', 'source_id']);- table.index('fk_workspace_id');- });- }+const up = async (_knex: Knex) => {+ // No-op: table creation handled by v0/nc_018_record_templates};-const down = async (knex: Knex) => {- await knex.schema.dropTableIfExists(MetaTable.RECORD_TEMPLATES);+const down = async (_knex: Knex) => {+ // No-op};export { up, down };diff --git a/packages/nocodb/src/meta/migrations/v2/nc_100_record_templates_enabled.ts b/packages/nocodb/src/meta/migrations/v2/nc_100_record_templates_enabled.tsindex ef5b28bd62..6eb92c84dc 100644--- a/packages/nocodb/src/meta/migrations/v2/nc_100_record_templates_enabled.ts+++ b/packages/nocodb/src/meta/migrations/v2/nc_100_record_templates_enabled.ts@@ -1,20 +1,16 @@+/**+ * DEPRECATED: The enabled column is now included in v0/nc_018_record_templates.+ * All new migrations should be added to XcMigrationSourcev0.+ * This file is kept only because the filesystem does not allow deletion.+ */import type { Knex } from 'knex';-import { MetaTable } from '~/utils/globals';-const up = async (knex: Knex) => {- if (!(await knex.schema.hasColumn(MetaTable.RECORD_TEMPLATES, 'enabled'))) {- await knex.schema.alterTable(MetaTable.RECORD_TEMPLATES, (table) => {- table.boolean('enabled').defaultTo(true);- });- }+const up = async (_knex: Knex) => {+ // No-op: enabled column now created in v0/nc_018_record_templates};-const down = async (knex: Knex) => {- if (await knex.schema.hasColumn(MetaTable.RECORD_TEMPLATES, 'enabled')) {- await knex.schema.alterTable(MetaTable.RECORD_TEMPLATES, (table) => {- table.dropColumn('enabled');- });- }+const down = async (_knex: Knex) => {+ // No-op};export { up, down };