Browse Source

fix: ignore throwing error in upgrader if error is index already exist

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/7195/head
Pranav C 1 year ago
parent
commit
b1612885b1
  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