aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-10-16 16:14:56 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-10-16 16:14:56 -0700
commit8919a68b961e2789286a1f9e71fd1b8a9ee7d3e0 (patch)
treeb76bb38481900fbdc4973cdfa0affdebfe823642 /activerecord/lib/active_record
parentf10d62c4bf0be035eafd3f38a9e50550e8060b21 (diff)
parent3dbedd2823ff6c8a1f2f078ae9df9c6ceb275e1b (diff)
downloadrails-8919a68b961e2789286a1f9e71fd1b8a9ee7d3e0.tar.gz
rails-8919a68b961e2789286a1f9e71fd1b8a9ee7d3e0.tar.bz2
rails-8919a68b961e2789286a1f9e71fd1b8a9ee7d3e0.zip
Merge pull request #3334 from mperham/master
Default timestamps to non-null
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
index 82f564e41d..989a4fcbca 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
@@ -252,7 +252,7 @@ module ActiveRecord
# Appends <tt>:datetime</tt> columns <tt>:created_at</tt> and
# <tt>:updated_at</tt> to the table.
def timestamps(*args)
- options = args.extract_options!
+ options = { :null => false }.merge(args.extract_options!)
column(:created_at, :datetime, options)
column(:updated_at, :datetime, options)
end
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 8e3ba1297e..b4a9e29ef1 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -507,8 +507,8 @@ module ActiveRecord
# ===== Examples
# add_timestamps(:suppliers)
def add_timestamps(table_name)
- add_column table_name, :created_at, :datetime
- add_column table_name, :updated_at, :datetime
+ add_column table_name, :created_at, :datetime, :null => false
+ add_column table_name, :updated_at, :datetime, :null => false
end
# Removes the timestamp columns (created_at and updated_at) from the table definition.