fix only add column if not exists for mysql

This commit is contained in:
Marcus Efraimsson
2018-12-18 23:02:08 +01:00
parent a451c20129
commit 12f3c8f9d6
5 changed files with 36 additions and 10 deletions
@@ -36,3 +36,13 @@ type IfIndexNotExistsCondition struct {
func (c *IfIndexNotExistsCondition) Sql(dialect Dialect) (string, []interface{}) {
return dialect.IndexCheckSql(c.TableName, c.IndexName)
}
type IfColumnNotExistsCondition struct {
NotExistsMigrationCondition
TableName string
ColumnName string
}
func (c *IfColumnNotExistsCondition) Sql(dialect Dialect) (string, []interface{}) {
return dialect.ColumnCheckSql(c.TableName, c.ColumnName)
}