diff options
author | Xavier Noria <fxn@hashref.com> | 2013-03-11 23:05:59 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2013-03-11 23:13:12 +0100 |
commit | cae93be0cac32eaa75746dda00454a26c4654be5 (patch) | |
tree | a375710a8ae1dc3876cf077a2a13b1227cb74e3d /activerecord/lib/active_record/connection_adapters | |
parent | efa5307f18000a21d83e23dc80beb32767ed3f25 (diff) | |
download | rails-cae93be0cac32eaa75746dda00454a26c4654be5.tar.gz rails-cae93be0cac32eaa75746dda00454a26c4654be5.tar.bz2 rails-cae93be0cac32eaa75746dda00454a26c4654be5.zip |
promotes change_column_null to the migrations API
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index 0f35f852f5..4f670d46d9 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -402,6 +402,26 @@ module ActiveRecord raise NotImplementedError, "change_column_default is not implemented" end + # Sets or removes a +NOT NULL+ constraint on a column. The +null+ flag + # indicates wheter the value can be +NULL+. For example + # + # change_column_null(:users, :nickname, false) + # + # says nicknames cannot be +NULL+ (adds the constraint), whereas + # + # change_column_null(:users, :nickname, true) + # + # allows them to be +NULL+ (drops the constraint). + # + # The method accepts an optional fourth argument to replace existing + # +NULL+s with some other value. Use that one when enabling the + # constraint if needed, since otherwise those rows would not be valid. + # + # Please note the fourth argument does not set a column's default. + def change_column_null(table_name, column_name, null, default = nil) + raise NotImplementedError, "change_column_null is not implemented" + end + # Renames a column. # # rename_column(:suppliers, :description, :name) |