mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-18 16:01:40 +03:00
Fixed model validation erroneously triggering on non-nullable text fields
refs https://github.com/TryGhost/Toolbox/issues/309 - I've just ran into a problem when deleting the `defaultTo` field on a non-nullable `text` column in our schema because this validation thinks there should be a value set - `text` fields cannot have defaults so the schema is incorrect, and the validation triggering is a bug that's preventing it from being cleaned up - the default is defined on the model so I don't think we're losing anything here
This commit is contained in:
parent
002cf5b0eb
commit
51498abb5c
@ -45,6 +45,8 @@ function validateSchema(tableName, model, options) {
|
|||||||
// check nullable
|
// check nullable
|
||||||
if (Object.prototype.hasOwnProperty.call(schema[tableName][columnKey], 'nullable') &&
|
if (Object.prototype.hasOwnProperty.call(schema[tableName][columnKey], 'nullable') &&
|
||||||
schema[tableName][columnKey].nullable !== true &&
|
schema[tableName][columnKey].nullable !== true &&
|
||||||
|
Object.prototype.hasOwnProperty.call(schema[tableName][columnKey], 'type') &&
|
||||||
|
schema[tableName][columnKey].type !== 'text' &&
|
||||||
!Object.prototype.hasOwnProperty.call(schema[tableName][columnKey], 'defaultTo')
|
!Object.prototype.hasOwnProperty.call(schema[tableName][columnKey], 'defaultTo')
|
||||||
) {
|
) {
|
||||||
if (validator.isEmpty(strVal)) {
|
if (validator.isEmpty(strVal)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user