Browse Source

Merge pull request #7195 from nocodb/fix/upgrader-error

fix: Ignore throwing error in upgrader if error is index already exist
pull/7200/head
Raju Udava 12 months ago committed by GitHub
parent
commit
368e6b0a80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      packages/nocodb/src/version-upgrader/ncXcdbLTARIndexUpgrader.ts

11
packages/nocodb/src/version-upgrader/ncXcdbLTARIndexUpgrader.ts

@ -75,7 +75,16 @@ async function upgradeModelRelationsIndex({
tn: childModel.table_name,
non_unique: true,
};
await sqlClient.indexCreate(indexArgs);
// wrap in try catch to skip if index already exists
try {
await sqlClient.indexCreate(indexArgs);
} catch (e) {
// ignore throwing if the error is index already exists
if (!/relation "?.+"? already exists/i.test(e.message)) {
throw e;
}
}
}
break;
}

Loading…
Cancel
Save