Browse Source

Merge pull request #5980 from nocodb/fix/5957-upgrader-error

fix: LTAR upgrader bug
pull/5983/head
Pranav C 1 year ago committed by GitHub
parent
commit
bec3fcd7a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      packages/nocodb/src/version-upgrader/ncXcdbLTARUpgrader.ts

25
packages/nocodb/src/version-upgrader/ncXcdbLTARUpgrader.ts

@ -44,6 +44,11 @@ async function upgradeModelRelations({
ncMeta, ncMeta,
); );
// if colOptions not found then skip
if (!colOptions) {
continue;
}
switch (colOptions.type) { switch (colOptions.type) {
case RelationTypes.HAS_MANY: case RelationTypes.HAS_MANY:
{ {
@ -77,17 +82,17 @@ async function upgradeModelRelations({
childTable: relation.tn, childTable: relation.tn,
foreignKeyName: relation.cstn, foreignKeyName: relation.cstn,
}); });
}
// skip postgres since we were already creating the index while creating the relation // skip postgres since we were already creating the index while creating the relation
if (ncMeta.knex.clientType() !== 'pg') { if (ncMeta.knex.clientType() !== 'pg') {
// create a new index for the column // create a new index for the column
const indexArgs = { const indexArgs = {
columns: [relation.cn], columns: [relation.cn],
tn: relation.tn, tn: relation.tn,
non_unique: true, non_unique: true,
}; };
await sqlClient.indexCreate(indexArgs); await sqlClient.indexCreate(indexArgs);
}
} }
} }
break; break;

Loading…
Cancel
Save