[#2992] fixed zero-default value not being used if the field is not explicitly set when manually creating records
This commit is contained in:
@@ -143,13 +143,17 @@ type SchemaField struct {
|
||||
func (f *SchemaField) ColDefinition() string {
|
||||
switch f.Type {
|
||||
case FieldTypeNumber:
|
||||
return "NUMERIC DEFAULT 0"
|
||||
return "NUMERIC DEFAULT 0 NOT NULL"
|
||||
case FieldTypeBool:
|
||||
return "BOOLEAN DEFAULT FALSE"
|
||||
return "BOOLEAN DEFAULT FALSE NOT NULL"
|
||||
case FieldTypeJson:
|
||||
return "JSON DEFAULT NULL"
|
||||
default:
|
||||
return "TEXT DEFAULT ''"
|
||||
if opt, ok := f.Options.(MultiValuer); ok && opt.IsMultiple() {
|
||||
return "JSON DEFAULT '[]' NOT NULL"
|
||||
}
|
||||
|
||||
return "TEXT DEFAULT '' NOT NULL"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user