Add IF NOT EXISTS parameter for creating indexes in postgresql case

This commit is contained in:
entwicklerfr 2018-10-18 22:34:22 +02:00
parent a9e0e920f5
commit bf7809f3dd

View File

@ -479,7 +479,7 @@ module.exports = function(strapi) {
? column
: `"${column}"`;
return ORM.knex.raw(`CREATE INDEX search_${_.toLower(indexName)} ON "${table}" USING gin(${attribute} gin_trgm_ops)`);
return ORM.knex.raw(`CREATE INDEX IF NOT EXISTS search_${_.toLower(indexName)} ON "${table}" USING gin(${attribute} gin_trgm_ops)`);
});
await Promise.all(indexes);