aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-04-04 09:16:02 +0200
committerYves Senn <yves.senn@gmail.com>2014-04-04 10:35:26 +0200
commit80f4a65bbd2372c01cfdf174e6446cd232d81e44 (patch)
tree72ceb0684b11f6dbdc36c594b7daabedb5f19659 /activerecord
parentf4226c3ab6651f6871e02f3c6754c29ab155b938 (diff)
downloadrails-80f4a65bbd2372c01cfdf174e6446cd232d81e44.tar.gz
rails-80f4a65bbd2372c01cfdf174e6446cd232d81e44.tar.bz2
rails-80f4a65bbd2372c01cfdf174e6446cd232d81e44.zip
test, show current adapter behavior for `add_column limit: nil`.
This is an illustration of https://github.com/rails/rails/pull/13435#issuecomment-33789752 Removing the limit from the PG and SQLite adapter solves the issue. MySQL is still affected by the issue.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/migration/column_attributes_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration/column_attributes_test.rb b/activerecord/test/cases/migration/column_attributes_test.rb
index ccf19fb4d0..6a02873cba 100644
--- a/activerecord/test/cases/migration/column_attributes_test.rb
+++ b/activerecord/test/cases/migration/column_attributes_test.rb
@@ -35,6 +35,14 @@ module ActiveRecord
assert_no_column TestModel, :last_name
end
+ def test_add_column_without_limit
+ # TODO: limit: nil should work with all adapters.
+ skip "MySQL wrongly enforces a limit of 255" if current_adapter?(:MysqlAdapter, :Mysql2Adapter)
+ add_column :test_models, :description, :string, limit: nil
+ TestModel.reset_column_information
+ assert_nil TestModel.columns_hash["description"].limit
+ end
+
if current_adapter?(:MysqlAdapter, :Mysql2Adapter)
def test_unabstracted_database_dependent_types
add_column :test_models, :intelligence_quotient, :tinyint