fix the default value

This commit is contained in:
astaxie
2016-01-15 08:43:02 +08:00
parent 4375ca84d1
commit 7dbeb2c39a
2 changed files with 8 additions and 5 deletions

View File

@@ -264,15 +264,18 @@ func getColumnDefault(fi *fieldInfo) string {
// These defaults will be useful if there no config value orm:"default" and NOT NULL is on
switch fi.fieldType {
case TypeDateField, TypeDateTimeField:
case TypeDateField, TypeDateTimeField, TypeTextField:
return v
case TypeBooleanField, TypeBitField, TypeSmallIntegerField, TypeIntegerField,
case TypeBitField, TypeSmallIntegerField, TypeIntegerField,
TypeBigIntegerField, TypePositiveBitField, TypePositiveSmallIntegerField,
TypePositiveIntegerField, TypePositiveBigIntegerField, TypeFloatField,
TypeDecimalField:
t = " DEFAULT %s "
d = "0"
case TypeBooleanField:
t = " DEFAULT %s "
d = "FALSE"
}
if fi.colDefault {