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
|
col.Nullable = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if colDefault != nil {
|
if colDefault != nil && *colDefault != "NULL" {
|
||||||
col.Default = *colDefault
|
col.Default = *colDefault
|
||||||
col.DefaultIsEmpty = false
|
col.DefaultIsEmpty = false
|
||||||
} else {
|
} else {
|
||||||
|
@ -404,9 +404,7 @@ func (db *mysql) GetColumns(queryer core.Queryer, ctx context.Context, tableName
|
||||||
}
|
}
|
||||||
|
|
||||||
if !col.DefaultIsEmpty {
|
if !col.DefaultIsEmpty {
|
||||||
if col.SQLType.IsText() {
|
if col.SQLType.IsTime() && col.Default != "CURRENT_TIMESTAMP" {
|
||||||
col.Default = "'" + col.Default + "'"
|
|
||||||
} else if col.SQLType.IsTime() && col.Default != "CURRENT_TIMESTAMP" {
|
|
||||||
col.Default = "'" + col.Default + "'"
|
col.Default = "'" + col.Default + "'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue