diff --git a/pkg/ddl/mysql/diff_create_table.go b/pkg/ddl/mysql/diff_create_table.go index dd49cf8..8445bbc 100644 --- a/pkg/ddl/mysql/diff_create_table.go +++ b/pkg/ddl/mysql/diff_create_table.go @@ -207,12 +207,10 @@ func (config *DiffCreateTableConfig) diffCreateTableColumn(ddls *DDL, before, af if beforeColumn.DataType.StringForDiff() != afterColumn.DataType.StringForDiff() || beforeColumn.CharacterSet.StringForDiff() != afterColumn.CharacterSet.StringForDiff() || beforeColumn.Collate.StringForDiff() != afterColumn.Collate.StringForDiff() || - (beforeColumn.NotNull && !afterColumn.NotNull) || - (!beforeColumn.NotNull && afterColumn.NotNull) || - (beforeColumn.AutoIncrement && !afterColumn.AutoIncrement) || - (!beforeColumn.AutoIncrement && afterColumn.AutoIncrement) || - (beforeColumn.OnAction != afterColumn.OnAction) || - (beforeColumn.Comment != afterColumn.Comment) { + beforeColumn.NotNull != afterColumn.NotNull || + beforeColumn.AutoIncrement != afterColumn.AutoIncrement || + beforeColumn.OnAction != afterColumn.OnAction || + beforeColumn.Comment != afterColumn.Comment { // ALTER TABLE table_name MODIFY column_name data_type NOT NULL; ddls.Stmts = append(ddls.Stmts, &AlterTableStmt{ Comment: simplediff.Diff(beforeColumn.String(), afterColumn.String()).String(), diff --git a/pkg/ddl/spanner/diff_create_table.go b/pkg/ddl/spanner/diff_create_table.go index 4f53ec0..c670574 100644 --- a/pkg/ddl/spanner/diff_create_table.go +++ b/pkg/ddl/spanner/diff_create_table.go @@ -162,8 +162,7 @@ func (config *DiffCreateTableConfig) diffCreateTableColumn(ddls *DDL, before, af } if beforeColumn.DataType.StringForDiff() != afterColumn.DataType.StringForDiff() || - beforeColumn.NotNull && !afterColumn.NotNull || - !beforeColumn.NotNull && afterColumn.NotNull { + beforeColumn.NotNull != afterColumn.NotNull { // ALTER TABLE table_name ALTER COLUMN column_name data_type NOT NULL; ddls.Stmts = append(ddls.Stmts, &AlterTableStmt{ Comment: simplediff.Diff(beforeColumn.String(), afterColumn.String()).String(),