Set column defaults correctly for mysql
Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
f39a4cb41c
commit
ded774e38d
|
@ -335,7 +335,7 @@ func (db *mysql) GetColumns(queryer core.Queryer, ctx context.Context, tableName
|
|||
col.Nullable = true
|
||||
}
|
||||
|
||||
if colDefault != nil {
|
||||
if colDefault != nil && *colDefault != "NULL" {
|
||||
col.Default = *colDefault
|
||||
col.DefaultIsEmpty = false
|
||||
} else {
|
||||
|
@ -404,9 +404,7 @@ func (db *mysql) GetColumns(queryer core.Queryer, ctx context.Context, tableName
|
|||
}
|
||||
|
||||
if !col.DefaultIsEmpty {
|
||||
if col.SQLType.IsText() {
|
||||
col.Default = "'" + col.Default + "'"
|
||||
} else if col.SQLType.IsTime() && col.Default != "CURRENT_TIMESTAMP" {
|
||||
if col.SQLType.IsTime() && col.Default != "CURRENT_TIMESTAMP" {
|
||||
col.Default = "'" + col.Default + "'"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue