aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-03-01 16:15:00 -0800
committerXavier Noria <fxn@hashref.com>2012-03-01 16:15:00 -0800
commitfcef72890b7f8b974ee490268a48e147bd621253 (patch)
tree252025841bbed9fa3807cd50f48e37640947b6dd /activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
parent447d87c206ff70046b15be99e73ec79690687bb9 (diff)
downloadrails-fcef72890b7f8b974ee490268a48e147bd621253.tar.gz
rails-fcef72890b7f8b974ee490268a48e147bd621253.tar.bz2
rails-fcef72890b7f8b974ee490268a48e147bd621253.zip
revert setting NOT NULL constraints in add_timestamps
Commit 3dbedd2 added NOT NULL constraints both to table creation and modification. For creation the new default makes sense, but the generic situation for changing a table is that there exist records. Those records have no creation or modification timestamps, and in the general case you don't even know them, so when updating a table these constraints are not going to work. See a bug report for this use case in #3334.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb4
1 files changed, 2 insertions, 2 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 6bac05191d..2c210e5ba2 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -539,8 +539,8 @@ module ActiveRecord
# ===== Examples
# add_timestamps(:suppliers)
def add_timestamps(table_name)
- add_column table_name, :created_at, :datetime, :null => false
- add_column table_name, :updated_at, :datetime, :null => false
+ add_column table_name, :created_at, :datetime
+ add_column table_name, :updated_at, :datetime
end
# Removes the timestamp columns (created_at and updated_at) from the table definition.