mirror of
https://github.com/strapi/strapi.git
synced 2025-11-09 14:51:29 +00:00
Handle default values with Bookshelf
This commit is contained in:
parent
cc6db73e33
commit
057d62b9f9
@ -89,7 +89,14 @@ module.exports = function(strapi) {
|
||||
tableName: definition.collectionName,
|
||||
hasTimestamps: _.get(definition, 'options.timestamps') === true,
|
||||
idAttribute: _.get(definition, 'options.idAttribute', 'id'),
|
||||
associations: []
|
||||
associations: [],
|
||||
defaults: Object.keys(definition.attributes).reduce((acc, current) => {
|
||||
if (definition.attributes[current].type && definition.attributes[current].default) {
|
||||
acc[current] = definition.attributes[current].default;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {})
|
||||
}, definition.options);
|
||||
|
||||
if (_.isString(_.get(connection, 'options.pivot_prefix'))) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user