Skip to content

Commit

Permalink
Nullify MySQL comments if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Bahanix committed Nov 11, 2024
1 parent d8753a0 commit 20a84c5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/sequel/adapters/shared/mysql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ def schema_parse_table(table_name, opts)
end
row[:allow_null] = row.delete(:Null) == 'YES'
row[:comment] = row.delete(:Comment)
row[:comment] = nil if row[:comment] == ""
row[:default] = row.delete(:Default)
row[:db_type] = row.delete(:Type)
row[:type] = schema_column_type(row[:db_type])
Expand Down
2 changes: 1 addition & 1 deletion spec/adapters/mysql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
Integer :b
end
@db.run("ALTER TABLE dolls CHANGE b b INT COMMENT 'blah'")
@db.schema(:dolls).map{|k, v| v[:comment]}.must_equal ["", 'blah']
@db.schema(:dolls).map{|k, v| v[:comment]}.must_equal [nil, 'blah']
end

it "should include an :auto_increment schema attribute if auto incrementing" do
Expand Down

0 comments on commit 20a84c5

Please sign in to comment.