Merge pull request #2167 from entwicklerfr/enhancement/Creating-indexes-should-use-the-suffix-IF-NOT-EXISTS#1850

Add IF NOT EXISTS parameter for creating indexes with PG
This commit is contained in:
Jim LAURIE 2018-10-19 11:39:17 +02:00 committed by GitHub
commit ea5c63a77f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);