mirror of
https://github.com/strapi/strapi.git
synced 2025-11-09 22:59:14 +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,
|
tableName: definition.collectionName,
|
||||||
hasTimestamps: _.get(definition, 'options.timestamps') === true,
|
hasTimestamps: _.get(definition, 'options.timestamps') === true,
|
||||||
idAttribute: _.get(definition, 'options.idAttribute', 'id'),
|
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);
|
}, definition.options);
|
||||||
|
|
||||||
if (_.isString(_.get(connection, 'options.pivot_prefix'))) {
|
if (_.isString(_.get(connection, 'options.pivot_prefix'))) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user