mirror of
https://github.com/strapi/strapi.git
synced 2025-08-28 10:45:51 +00:00
Fix PR feedback
This commit is contained in:
parent
054df448a9
commit
f545f373aa
@ -235,10 +235,13 @@ module.exports = {
|
|||||||
syncSchema: (cb) => {
|
syncSchema: (cb) => {
|
||||||
const Model = strapi.plugins['users-permissions'].models.user;
|
const Model = strapi.plugins['users-permissions'].models.user;
|
||||||
|
|
||||||
if (Model.orm === 'bookshelf') {
|
if (Model.orm !== 'bookshelf') {
|
||||||
|
return cb();
|
||||||
|
}
|
||||||
|
|
||||||
const tableName = Model.collectionName;
|
const tableName = Model.collectionName;
|
||||||
|
|
||||||
let queue = new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
strapi.connections[Model.connection].schema.hasTable(tableName)
|
strapi.connections[Model.connection].schema.hasTable(tableName)
|
||||||
.then(exist => {
|
.then(exist => {
|
||||||
if (!exist) {
|
if (!exist) {
|
||||||
@ -266,9 +269,8 @@ CREATE TABLE "${tableName}" (
|
|||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
.then(() => {
|
||||||
queue = queue.then(() => {
|
|
||||||
const attributes = _.cloneDeep(Model.attributes);
|
const attributes = _.cloneDeep(Model.attributes);
|
||||||
attributes.id = {
|
attributes.id = {
|
||||||
type: 'integer'
|
type: 'integer'
|
||||||
@ -296,12 +298,7 @@ CREATE TABLE "${tableName}" (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const testsColumns = [];
|
const testsColumns = Object.entries(attributes).map(([attribute, description]) => columnExist(description, attribute));
|
||||||
|
|
||||||
_.forEach(attributes, (description, attribute) => {
|
|
||||||
testsColumns.push(columnExist(description, attribute));
|
|
||||||
});
|
|
||||||
|
|
||||||
Promise.all(testsColumns)
|
Promise.all(testsColumns)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (!_.isEmpty(commands)) {
|
if (!_.isEmpty(commands)) {
|
||||||
@ -320,8 +317,5 @@ ${commands}
|
|||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
cb();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user