diff options
author | Mike Perham <mperham@gmail.com> | 2011-10-14 21:09:53 -0700 |
---|---|---|
committer | Mike Perham <mperham@gmail.com> | 2011-10-14 21:09:53 -0700 |
commit | 3dbedd2823ff6c8a1f2f078ae9df9c6ceb275e1b (patch) | |
tree | a0580734399025a32c6be877c2f96d8955dbb1a2 /activerecord/lib/active_record/connection_adapters | |
parent | e759c8882a990606bb4aee8a643431ebe544c69f (diff) | |
download | rails-3dbedd2823ff6c8a1f2f078ae9df9c6ceb275e1b.tar.gz rails-3dbedd2823ff6c8a1f2f078ae9df9c6ceb275e1b.tar.bz2 rails-3dbedd2823ff6c8a1f2f078ae9df9c6ceb275e1b.zip |
Default timestamps to non-null
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 4 |
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. |