Browse Source

refactor: rename enum alias

pull/9499/head
Pranav C 3 months ago
parent
commit
37bd38a4c9
  1. 4
      packages/nocodb/src/helpers/initDataSourceEncryption.ts
  2. 2
      packages/nocodb/src/meta/meta.service.ts
  3. 8
      packages/nocodb/src/meta/migrations/v2/nc_037_rename_project_and_base.ts
  4. 4
      packages/nocodb/src/meta/migrations/v2/nc_042_integrations.ts
  5. 4
      packages/nocodb/src/meta/migrations/v2/nc_050_tenant_isolation.ts
  6. 4
      packages/nocodb/src/meta/migrations/v2/nc_051_source_readonly_columns.ts
  7. 4
      packages/nocodb/src/meta/migrations/v2/nc_054_id_length.ts
  8. 18
      packages/nocodb/src/meta/migrations/v2/nc_056_integration.ts
  9. 4
      packages/nocodb/src/meta/migrations/v2/nc_063_encrypt_flag.ts
  10. 4
      packages/nocodb/src/models/Integration.spec.ts
  11. 22
      packages/nocodb/src/models/Integration.ts
  12. 64
      packages/nocodb/src/models/Source.ts
  13. 6
      packages/nocodb/src/services/integrations.service.ts
  14. 6
      packages/nocodb/src/utils/globals.ts
  15. 2
      packages/nocodb/src/version-upgrader/upgraders/0101002_ncAttachmentUpgrader.ts
  16. 2
      packages/nocodb/src/version-upgrader/upgraders/0104002_ncAttachmentUpgrader.ts
  17. 2
      packages/nocodb/src/version-upgrader/upgraders/0107004_ncProjectConfigUpgrader.ts
  18. 2
      packages/nocodb/src/version-upgrader/upgraders/0108002_ncXcdbLTARUpgrader.ts
  19. 2
      packages/nocodb/src/version-upgrader/upgraders/0111002_ncXcdbLTARIndexUpgrader.ts
  20. 2
      packages/nocodb/src/version-upgrader/upgraders/0111005_ncXcdbCreatedAndUpdatedSystemFieldsUpgrader.ts
  21. 4
      packages/nocodb/src/version-upgrader/upgraders/0225002_ncDatasourceDecrypt.ts

4
packages/nocodb/src/helpers/initDataSourceEncryption.ts

@ -16,7 +16,7 @@ export default async function initDataSourceEncryption(_ncMeta = Noco.ncMeta) {
try {
// if configured, check for any non-encrypted data source by checking is_encrypted flag
const sources = await ncMeta
.knex(MetaTable.BASES)
.knex(MetaTable.SOURCES)
.where((qb) => {
qb.where('is_encrypted', false).orWhereNull('is_encrypted');
})
@ -33,7 +33,7 @@ export default async function initDataSourceEncryption(_ncMeta = Noco.ncMeta) {
await ncMeta.metaUpdate(
source.fk_workspace_id,
source.id,
MetaTable.BASES,
MetaTable.SOURCES,
{
config: encryptPropIfRequired({
data: source,

2
packages/nocodb/src/meta/meta.service.ts

@ -292,7 +292,7 @@ export class MetaService {
public async genNanoid(target: string) {
const prefixMap: { [key: string]: string } = {
[MetaTable.PROJECT]: 'p',
[MetaTable.BASES]: 'b',
[MetaTable.SOURCES]: 'b',
[MetaTable.MODELS]: 'm',
[MetaTable.COLUMNS]: 'c',
[MetaTable.COL_RELATIONS]: 'l',

8
packages/nocodb/src/meta/migrations/v2/nc_037_rename_project_and_base.ts

@ -7,7 +7,7 @@ const logger = new Logger('nc_036_rename_project_and_base');
const up = async (knex: Knex) => {
logger.log('Renaming base table');
if (await knex.schema.hasTable(MetaTableOldV2.BASES))
await knex.schema.renameTable(MetaTableOldV2.BASES, MetaTable.BASES);
await knex.schema.renameTable(MetaTableOldV2.BASES, MetaTable.SOURCES);
logger.log('Renaming `base_id` column to `source_id`');
if (await knex.schema.hasColumn(MetaTable.MODELS, 'base_id'))
@ -349,10 +349,10 @@ const up = async (knex: Knex) => {
});
logger.log(
`Renaming 'project_id' column to 'base_id' in '${MetaTable.BASES}' table`,
`Renaming 'project_id' column to 'base_id' in '${MetaTable.SOURCES}' table`,
);
if (await knex.schema.hasColumn(MetaTable.BASES, 'project_id'))
await knex.schema.alterTable(MetaTable.BASES, (table) => {
if (await knex.schema.hasColumn(MetaTable.SOURCES, 'project_id'))
await knex.schema.alterTable(MetaTable.SOURCES, (table) => {
table.renameColumn('project_id', 'base_id');
});

4
packages/nocodb/src/meta/migrations/v2/nc_042_integrations.ts

@ -24,7 +24,7 @@ const up = async (knex: Knex) => {
table.timestamps(true, true);
});
await knex.schema.alterTable(MetaTable.BASES, (table) => {
await knex.schema.alterTable(MetaTable.SOURCES, (table) => {
table.string('fk_integration_id', 20);
});
@ -36,7 +36,7 @@ const up = async (knex: Knex) => {
const down = async (knex: Knex) => {
await knex.schema.dropTable(MetaTable.INTEGRATIONS);
await knex.schema.alterTable(MetaTable.BASES, (table) => {
await knex.schema.alterTable(MetaTable.SOURCES, (table) => {
table.dropColumn('fk_integration_id');
});
};

4
packages/nocodb/src/meta/migrations/v2/nc_050_tenant_isolation.ts

@ -269,7 +269,7 @@ const up = async (knex: Knex) => {
// Drop existing base_id indexes
const dropBaseIdIndexes = [
MetaTable.AUDIT,
MetaTable.BASES,
MetaTable.SOURCES,
MetaTable.MODELS,
MetaTable.PROJECT_USERS,
MetaTable.SYNC_SOURCE,
@ -349,7 +349,7 @@ const up = async (knex: Knex) => {
MetaTable.MAP_VIEW,
MetaTable.MODELS,
MetaTable.SORT,
MetaTable.BASES,
MetaTable.SOURCES,
MetaTable.SYNC_LOGS,
MetaTable.SYNC_SOURCE,
MetaTable.VIEWS,

4
packages/nocodb/src/meta/migrations/v2/nc_051_source_readonly_columns.ts

@ -2,14 +2,14 @@ import type { Knex } from 'knex';
import { MetaTable } from '~/utils/globals';
const up = async (knex: Knex) => {
await knex.schema.alterTable(MetaTable.BASES, (table) => {
await knex.schema.alterTable(MetaTable.SOURCES, (table) => {
table.boolean('is_schema_readonly').defaultTo(false);
table.boolean('is_data_readonly').defaultTo(false);
});
};
const down = async (knex: Knex) => {
await knex.schema.alterTable(MetaTable.BASES, (table) => {
await knex.schema.alterTable(MetaTable.SOURCES, (table) => {
table.dropColumn('is_schema_readonly');
table.dropColumn('is_data_readonly');
});

4
packages/nocodb/src/meta/migrations/v2/nc_054_id_length.ts

@ -107,7 +107,7 @@ export const replaceLongBaseIds = async (knex: Knex) => {
MetaTable.MAP_VIEW,
MetaTable.MODELS,
MetaTable.SORT,
MetaTable.BASES,
MetaTable.SOURCES,
MetaTable.SYNC_LOGS,
MetaTable.SYNC_SOURCE,
MetaTable.USER_COMMENTS_NOTIFICATIONS_PREFERENCE,
@ -147,7 +147,7 @@ const tablesToAlterBaseId = [
MetaTable.MAP_VIEW_COLUMNS,
MetaTable.MODELS,
MetaTable.SORT,
MetaTable.BASES,
MetaTable.SOURCES,
MetaTable.SYNC_LOGS,
MetaTable.SYNC_SOURCE,
MetaTable.USER_COMMENTS_NOTIFICATIONS_PREFERENCE,

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

@ -36,8 +36,8 @@ const up = async (knex: Knex) => {
});
}
if (!(await knex.schema.hasColumn(MetaTable.BASES, 'fk_integration_id'))) {
await knex.schema.alterTable(MetaTable.BASES, (table) => {
if (!(await knex.schema.hasColumn(MetaTable.SOURCES, 'fk_integration_id'))) {
await knex.schema.alterTable(MetaTable.SOURCES, (table) => {
table.string('fk_integration_id', 20).index();
});
}
@ -45,18 +45,18 @@ const up = async (knex: Knex) => {
hrTime = process.hrtime();
// get all external sources, add them to integrations table and map back to bases
const sources = await knex(MetaTable.BASES)
.select(`${MetaTable.BASES}.*`)
const sources = await knex(MetaTable.SOURCES)
.select(`${MetaTable.SOURCES}.*`)
.select(`${MetaTable.PROJECT_USERS}.fk_user_id as created_by`)
.innerJoin(
MetaTable.PROJECT,
`${MetaTable.BASES}.base_id`,
`${MetaTable.SOURCES}.base_id`,
`${MetaTable.PROJECT}.id`,
)
.where((qb) =>
qb
.where(`${MetaTable.BASES}.is_meta`, false)
.orWhereNull(`${MetaTable.BASES}.is_meta`),
.where(`${MetaTable.SOURCES}.is_meta`, false)
.orWhereNull(`${MetaTable.SOURCES}.is_meta`),
)
.leftJoin(MetaTable.PROJECT_USERS, (qb) => {
qb.on(
@ -86,7 +86,7 @@ const up = async (knex: Knex) => {
};
await knex(MetaTable.INTEGRATIONS).insert(integration);
await knex(MetaTable.BASES).where('id', source.id).update({
await knex(MetaTable.SOURCES).where('id', source.id).update({
fk_integration_id: integrationId,
});
}
@ -97,7 +97,7 @@ const up = async (knex: Knex) => {
const down = async (knex: Knex) => {
await knex.schema.dropTable(MetaTable.INTEGRATIONS);
await knex.schema.alterTable(MetaTable.BASES, (table) => {
await knex.schema.alterTable(MetaTable.SOURCES, (table) => {
table.dropColumn('fk_integration_id');
});
};

4
packages/nocodb/src/meta/migrations/v2/nc_063_encrypt_flag.ts

@ -2,7 +2,7 @@ import type { Knex } from 'knex';
import { MetaTable } from '~/utils/globals';
const up = async (knex: Knex) => {
await knex.schema.alterTable(MetaTable.BASES, (table) => {
await knex.schema.alterTable(MetaTable.SOURCES, (table) => {
table.boolean('is_encrypted').defaultTo(false).index();
});
await knex.schema.alterTable(MetaTable.INTEGRATIONS, (table) => {
@ -11,7 +11,7 @@ const up = async (knex: Knex) => {
};
const down = async (knex: Knex) => {
await knex.schema.alterTable(MetaTable.BASES, (table) => {
await knex.schema.alterTable(MetaTable.SOURCES, (table) => {
table.dropColumn('is_encrypted');
});
await knex.schema.alterTable(MetaTable.INTEGRATIONS, (table) => {

4
packages/nocodb/src/models/Integration.spec.ts

@ -117,7 +117,7 @@ describe('Integration Model', () => {
title: 'New Integration',
workspaceId: 'workspace-1',
config: {
client: 'pg'
client: 'pg',
},
};
mockNcMeta.metaInsert2.mockResolvedValue({
@ -168,7 +168,7 @@ describe('Integration Model', () => {
title: 'New Integration',
workspaceId: 'workspace-1',
config: {
client: 'pg'
client: 'pg',
},
};
mockNcMeta.metaInsert2.mockResolvedValue({

22
packages/nocodb/src/models/Integration.ts

@ -222,12 +222,12 @@ export default class Integration implements IntegrationType {
listQb
.select(
`${MetaTable.INTEGRATIONS}.*`,
ncMeta.knex.raw(`count(${MetaTable.BASES}.id) as source_count`),
ncMeta.knex.raw(`count(${MetaTable.SOURCES}.id) as source_count`),
)
.leftJoin(
MetaTable.BASES,
MetaTable.SOURCES,
`${MetaTable.INTEGRATIONS}.id`,
`${MetaTable.BASES}.fk_integration_id`,
`${MetaTable.SOURCES}.fk_integration_id`,
)
.groupBy(`${MetaTable.INTEGRATIONS}.id`);
}
@ -367,23 +367,23 @@ export default class Integration implements IntegrationType {
}
async getSources(ncMeta = Noco.ncMeta): Promise<any> {
const qb = ncMeta.knex(MetaTable.BASES);
const qb = ncMeta.knex(MetaTable.SOURCES);
const sources = await qb
.select(`${MetaTable.BASES}.id`)
.select(`${MetaTable.BASES}.alias`)
.select(`${MetaTable.SOURCES}.id`)
.select(`${MetaTable.SOURCES}.alias`)
.select(`${MetaTable.PROJECT}.title as project_title`)
.select(`${MetaTable.BASES}.base_id`)
.select(`${MetaTable.SOURCES}.base_id`)
.innerJoin(
MetaTable.PROJECT,
`${MetaTable.BASES}.base_id`,
`${MetaTable.SOURCES}.base_id`,
`${MetaTable.PROJECT}.id`,
)
.where(`${MetaTable.BASES}.fk_integration_id`, this.id)
.where(`${MetaTable.SOURCES}.fk_integration_id`, this.id)
.where((whereQb) => {
whereQb
.where(`${MetaTable.BASES}.deleted`, false)
.orWhereNull(`${MetaTable.BASES}.deleted`);
.where(`${MetaTable.SOURCES}.deleted`, false)
.orWhereNull(`${MetaTable.SOURCES}.deleted`);
})
.where((whereQb) => {
whereQb

64
packages/nocodb/src/models/Source.ts

@ -96,23 +96,23 @@ export default class Source implements SourceType {
insertObj.meta = stringifyMetaProp(insertObj);
}
insertObj.order = await ncMeta.metaGetNextOrder(MetaTable.BASES, {
insertObj.order = await ncMeta.metaGetNextOrder(MetaTable.SOURCES, {
base_id: source.baseId,
});
const { id } = await ncMeta.metaInsert2(
context.workspace_id,
context.base_id,
MetaTable.BASES,
MetaTable.SOURCES,
insertObj,
);
const returnBase = await this.get(context, id, false, ncMeta);
await NocoCache.appendToList(
CacheScope.BASE,
CacheScope.SOURCE,
[source.baseId],
`${CacheScope.BASE}:${id}`,
`${CacheScope.SOURCE}:${id}`,
);
return returnBase;
@ -167,7 +167,7 @@ export default class Source implements SourceType {
// if order is missing (possible in old versions), get next order
if (!oldSource.order && !updateObj.order) {
updateObj.order = await ncMeta.metaGetNextOrder(MetaTable.BASES, {
updateObj.order = await ncMeta.metaGetNextOrder(MetaTable.SOURCES, {
base_id: oldSource.base_id,
});
@ -189,7 +189,7 @@ export default class Source implements SourceType {
// if order is 1 for non-default source, move it to last
if (oldSource.order <= 1 && !updateObj.order) {
updateObj.order = await ncMeta.metaGetNextOrder(MetaTable.BASES, {
updateObj.order = await ncMeta.metaGetNextOrder(MetaTable.SOURCES, {
base_id: oldSource.base_id,
});
}
@ -198,13 +198,13 @@ export default class Source implements SourceType {
await ncMeta.metaUpdate(
context.workspace_id,
context.base_id,
MetaTable.BASES,
MetaTable.SOURCES,
prepareForDb(updateObj),
oldSource.id,
);
await NocoCache.update(
`${CacheScope.BASE}:${sourceId}`,
`${CacheScope.SOURCE}:${sourceId}`,
prepareForResponse(updateObj),
);
@ -226,20 +226,20 @@ export default class Source implements SourceType {
args: { baseId: string },
ncMeta = Noco.ncMeta,
): Promise<Source[]> {
const cachedList = await NocoCache.getList(CacheScope.BASE, [args.baseId]);
const cachedList = await NocoCache.getList(CacheScope.SOURCE, [args.baseId]);
let { list: sourceDataList } = cachedList;
const { isNoneList } = cachedList;
if (!isNoneList && !sourceDataList.length) {
const qb = ncMeta
.knex(MetaTable.BASES)
.select(`${MetaTable.BASES}.*`)
.where(`${MetaTable.BASES}.base_id`, context.base_id)
.knex(MetaTable.SOURCES)
.select(`${MetaTable.SOURCES}.*`)
.where(`${MetaTable.SOURCES}.base_id`, context.base_id)
.where((whereQb) => {
whereQb
.where(`${MetaTable.BASES}.deleted`, false)
.orWhereNull(`${MetaTable.BASES}.deleted`);
.where(`${MetaTable.SOURCES}.deleted`, false)
.orWhereNull(`${MetaTable.SOURCES}.deleted`);
})
.orderBy(`${MetaTable.BASES}.order`, 'asc');
.orderBy(`${MetaTable.SOURCES}.order`, 'asc');
this.extendQb(qb, context);
@ -250,7 +250,7 @@ export default class Source implements SourceType {
source.meta = parseMetaProp(source, 'meta');
}
await NocoCache.setList(CacheScope.BASE, [args.baseId], sourceDataList);
await NocoCache.setList(CacheScope.SOURCE, [args.baseId], sourceDataList);
}
sourceDataList.sort(
@ -271,23 +271,23 @@ export default class Source implements SourceType {
let sourceData =
id &&
(await NocoCache.get(
`${CacheScope.BASE}:${id}`,
`${CacheScope.SOURCE}:${id}`,
CacheGetType.TYPE_OBJECT,
));
if (!sourceData) {
const qb = ncMeta
.knex(MetaTable.BASES)
.select(`${MetaTable.BASES}.*`)
.where(`${MetaTable.BASES}.id`, id)
.where(`${MetaTable.BASES}.base_id`, context.base_id);
.knex(MetaTable.SOURCES)
.select(`${MetaTable.SOURCES}.*`)
.where(`${MetaTable.SOURCES}.id`, id)
.where(`${MetaTable.SOURCES}.base_id`, context.base_id);
this.extendQb(qb, context);
if (!force) {
qb.where((whereQb) => {
whereQb
.where(`${MetaTable.BASES}.deleted`, false)
.orWhereNull(`${MetaTable.BASES}.deleted`);
.where(`${MetaTable.SOURCES}.deleted`, false)
.orWhereNull(`${MetaTable.SOURCES}.deleted`);
});
}
@ -297,7 +297,7 @@ export default class Source implements SourceType {
sourceData.meta = parseMetaProp(sourceData, 'meta');
}
await NocoCache.set(`${CacheScope.BASE}:${id}`, sourceData);
await NocoCache.set(`${CacheScope.SOURCE}:${id}`, sourceData);
}
return this.castType(sourceData);
}
@ -476,12 +476,12 @@ export default class Source implements SourceType {
const res = await ncMeta.metaDelete(
context.workspace_id,
context.base_id,
MetaTable.BASES,
MetaTable.SOURCES,
this.id,
);
await NocoCache.deepDel(
`${CacheScope.BASE}:${this.id}`,
`${CacheScope.SOURCE}:${this.id}`,
CacheDelDirection.CHILD_TO_PARENT,
);
@ -506,7 +506,7 @@ export default class Source implements SourceType {
await Source.update(context, this.id, { deleted: true }, ncMeta);
await NocoCache.deepDel(
`${CacheScope.BASE}:${this.id}`,
`${CacheScope.SOURCE}:${this.id}`,
CacheDelDirection.CHILD_TO_PARENT,
);
}
@ -528,14 +528,14 @@ export default class Source implements SourceType {
await ncMeta.metaUpdate(
context.workspace_id,
context.base_id,
MetaTable.BASES,
MetaTable.SOURCES,
{
erd_uuid: this.erd_uuid,
},
this.id,
);
await NocoCache.update(`${CacheScope.BASE}:${this.id}`, {
await NocoCache.update(`${CacheScope.SOURCE}:${this.id}`, {
erd_uuid: this.erd_uuid,
});
}
@ -550,14 +550,14 @@ export default class Source implements SourceType {
await ncMeta.metaUpdate(
context.workspace_id,
context.base_id,
MetaTable.BASES,
MetaTable.SOURCES,
{
erd_uuid: this.erd_uuid,
},
this.id,
);
await NocoCache.update(`${CacheScope.BASE}:${this.id}`, {
await NocoCache.update(`${CacheScope.SOURCE}:${this.id}`, {
erd_uuid: this.erd_uuid,
});
}
@ -581,7 +581,7 @@ export default class Source implements SourceType {
`${MetaTable.INTEGRATIONS}.title as integration_title`,
).leftJoin(
MetaTable.INTEGRATIONS,
`${MetaTable.BASES}.fk_integration_id`,
`${MetaTable.SOURCES}.fk_integration_id`,
`${MetaTable.INTEGRATIONS}.id`,
);
}

6
packages/nocodb/src/services/integrations.service.ts

@ -120,7 +120,7 @@ export class IntegrationsService {
// get linked sources
const sourceListQb = ncMeta
.knex(MetaTable.BASES)
.knex(MetaTable.SOURCES)
.where({
fk_integration_id: integration.id,
})
@ -309,7 +309,7 @@ export class IntegrationsService {
const sources = await ncMeta.metaList2(
integration.fk_workspace_id,
RootScopes.WORKSPACE,
MetaTable.BASES,
MetaTable.SOURCES,
{
condition: {
fk_integration_id: integration.id,
@ -336,7 +336,7 @@ export class IntegrationsService {
const source = new Source(sourceObj);
// update the cache with the new config(encrypted)
await NocoCache.update(`${CacheScope.BASE}:${source.id}`, {
await NocoCache.update(`${CacheScope.SOURCE}:${source.id}`, {
integration_config: integration.config,
});

6
packages/nocodb/src/utils/globals.ts

@ -1,6 +1,6 @@
export enum MetaTable {
PROJECT = 'nc_bases_v2',
BASES = 'nc_sources_v2',
SOURCES = 'nc_sources_v2',
MODELS = 'nc_models_v2',
COLUMNS = 'nc_columns_v2',
COLUMN_VALIDATIONS = 'nc_columns_validations_v2',
@ -100,7 +100,7 @@ export const orderedMetaTables = [
MetaTable.COLUMN_VALIDATIONS,
MetaTable.COLUMNS,
MetaTable.MODELS,
MetaTable.BASES,
MetaTable.SOURCES,
MetaTable.PROJECT,
];
@ -132,7 +132,7 @@ export const sakilaTableNames = [
export enum CacheScope {
PROJECT = 'base',
BASE = 'source',
SOURCE = 'source',
MODEL = 'model',
COLUMN = 'column',
COL_PROP = 'colProp',

2
packages/nocodb/src/version-upgrader/upgraders/0101002_ncAttachmentUpgrader.ts

@ -46,7 +46,7 @@ function getTnPath(knex: XKnex, tb: Model) {
}
export default async function ({ ncMeta }: NcUpgraderCtx) {
const sources: SourceType[] = await ncMeta.knexConnection(MetaTable.BASES);
const sources: SourceType[] = await ncMeta.knexConnection(MetaTable.SOURCES);
for (const _base of sources) {
const source = new Source(_base);

2
packages/nocodb/src/version-upgrader/upgraders/0104002_ncAttachmentUpgrader.ts

@ -37,7 +37,7 @@ function getTnPath(knex: XKnex, tb: Model) {
}
export default async function ({ ncMeta }: NcUpgraderCtx) {
const sources: SourceType[] = await ncMeta.knexConnection(MetaTable.BASES);
const sources: SourceType[] = await ncMeta.knexConnection(MetaTable.SOURCES);
for (const _base of sources) {
const source = new Source(_base);

2
packages/nocodb/src/version-upgrader/upgraders/0107004_ncProjectConfigUpgrader.ts

@ -13,7 +13,7 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
const actions = [];
// Get all the base sources
const sources = await ncMeta.knexConnection(MetaTable.BASES);
const sources = await ncMeta.knexConnection(MetaTable.SOURCES);
// Update the base config with the new secret key if we could decrypt the base config with the fallback secret key
for (const source of sources) {

2
packages/nocodb/src/version-upgrader/upgraders/0108002_ncXcdbLTARUpgrader.ts

@ -163,7 +163,7 @@ async function upgradeBaseRelations(
// database to virtual relation and create an index for it
export default async function ({ ncMeta }: NcUpgraderCtx) {
// get all xcdb sources
const sources = await ncMeta.knexConnection(MetaTable.BASES).where({
const sources = await ncMeta.knexConnection(MetaTable.SOURCES).where({
is_meta: 1,
});

2
packages/nocodb/src/version-upgrader/upgraders/0111002_ncXcdbLTARIndexUpgrader.ts

@ -151,7 +151,7 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
);
// get all xcdb sources
const sources = await ncMeta.knexConnection(MetaTable.BASES).where({
const sources = await ncMeta.knexConnection(MetaTable.SOURCES).where({
is_meta: 1,
});

2
packages/nocodb/src/version-upgrader/upgraders/0111005_ncXcdbCreatedAndUpdatedSystemFieldsUpgrader.ts

@ -370,7 +370,7 @@ async function upgradeModels({
// database to virtual relation and create an index for it
export default async function ({ ncMeta }: NcUpgraderCtx) {
// get all xcdb sources
const sources = await ncMeta.knexConnection(MetaTable.BASES).condition({
const sources = await ncMeta.knexConnection(MetaTable.SOURCES).condition({
_or: [
{
is_meta: {

4
packages/nocodb/src/version-upgrader/upgraders/0225002_ncDatasourceDecrypt.ts

@ -36,7 +36,7 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
}
// get all external sources
const sources = await ncMeta.knexConnection(MetaTable.BASES).condition({
const sources = await ncMeta.knexConnection(MetaTable.SOURCES).condition({
_not: {
_or: [
{
@ -64,7 +64,7 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
if (source?.config) {
try {
const decrypted = await decyptConfig(source.config, encryptionKey);
await ncMeta.knexConnection(MetaTable.BASES).update({
await ncMeta.knexConnection(MetaTable.SOURCES).update({
config: decrypted,
});
passed.push(true);

Loading…
Cancel
Save