mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 07:03:38 +00:00
Fix PR feedback
This commit is contained in:
parent
fdcecff2e6
commit
6cbddab6c8
@ -482,7 +482,6 @@ module.exports = function(strapi) {
|
||||
try {
|
||||
const connection = strapi.config.connections[definition.connection];
|
||||
let columns = Object.keys(attributes).filter(attribute => ['string', 'text'].includes(attributes[attribute].type));
|
||||
let indexes;
|
||||
|
||||
if (!columns.length) {
|
||||
// No text columns founds, exit from creating Fulltext Index
|
||||
@ -498,12 +497,12 @@ module.exports = function(strapi) {
|
||||
// Create fulltext indexes for every column.
|
||||
await ORM.knex.raw(`CREATE FULLTEXT INDEX SEARCH_${_.toUpper(_.snakeCase(table))} ON \`${table}\` (${columns})`);
|
||||
break;
|
||||
case 'pg':
|
||||
case 'pg': {
|
||||
// Enable extension to allow GIN indexes.
|
||||
await ORM.knex.raw('CREATE EXTENSION IF NOT EXISTS pg_trgm');
|
||||
|
||||
// Create GIN indexes for every column.
|
||||
indexes = columns
|
||||
const indexes = columns
|
||||
.map(column => {
|
||||
const indexName = `${_.snakeCase(table)}_${column}`;
|
||||
const attribute = _.toLower(column) === column
|
||||
@ -515,6 +514,7 @@ module.exports = function(strapi) {
|
||||
|
||||
await Promise.all(indexes);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// Handle duplicate errors.
|
||||
|
||||
@ -150,7 +150,9 @@ module.exports = strapi => {
|
||||
break;
|
||||
case 'sqlite3':
|
||||
// Create the directory if it does not exist.
|
||||
if (!fs.existsSync(fileDirectory)){
|
||||
try {
|
||||
fs.statSync(fileDirectory);
|
||||
} catch (err) {
|
||||
fs.mkdirSync(fileDirectory);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user