aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/schema/schema.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-09-23 09:15:59 -0600
committerSean Griffin <sean@seantheprogrammer.com>2015-09-23 09:15:59 -0600
commit2c7d0d42ac539484918c1cf60be4f24dc5587ad0 (patch)
tree7eedb41f2d8ff26e4113685fa6ab5812f13fcea1 /activerecord/test/schema/schema.rb
parentf696494aedf453d8fd51a13005dfbd34477ccc45 (diff)
downloadrails-2c7d0d42ac539484918c1cf60be4f24dc5587ad0.tar.gz
rails-2c7d0d42ac539484918c1cf60be4f24dc5587ad0.tar.bz2
rails-2c7d0d42ac539484918c1cf60be4f24dc5587ad0.zip
0 precision is not the same as no precision
And we are passing them as separate types in the query, which means 0 precision is still not supported by older versions of MySQL. I also missed a handful of other cases where they need to be conditionally applied.
Diffstat (limited to 'activerecord/test/schema/schema.rb')
-rw-r--r--activerecord/test/schema/schema.rb36
1 files changed, 28 insertions, 8 deletions
diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb
index c39b8d28ca..4c6d1ef3ce 100644
--- a/activerecord/test/schema/schema.rb
+++ b/activerecord/test/schema/schema.rb
@@ -536,10 +536,17 @@ ActiveRecord::Schema.define do
t.column :color, :string
t.column :parrot_sti_class, :string
t.column :killer_id, :integer
- t.column :created_at, :datetime, precision: 0
- t.column :created_on, :datetime, precision: 0
- t.column :updated_at, :datetime, precision: 0
- t.column :updated_on, :datetime, precision: 0
+ if subsecond_precision_supported?
+ t.column :created_at, :datetime, precision: 0
+ t.column :created_on, :datetime, precision: 0
+ t.column :updated_at, :datetime, precision: 0
+ t.column :updated_on, :datetime, precision: 0
+ else
+ t.column :created_at, :datetime
+ t.column :created_on, :datetime
+ t.column :updated_at, :datetime
+ t.column :updated_on, :datetime
+ end
end
create_table :parrots_pirates, id: false, force: true do |t|
@@ -582,15 +589,24 @@ ActiveRecord::Schema.define do
create_table :pets, primary_key: :pet_id, force: true do |t|
t.string :name
t.integer :owner_id, :integer
- t.timestamps null: false, precision: 6
+ if subsecond_precision_supported?
+ t.timestamps null: false, precision: 6
+ else
+ t.timestamps null: false
+ end
end
create_table :pirates, force: true do |t|
t.column :catchphrase, :string
t.column :parrot_id, :integer
t.integer :non_validated_parrot_id
- t.column :created_on, :datetime, precision: 6
- t.column :updated_on, :datetime, precision: 6
+ if subsecond_precision_supported?
+ t.column :created_on, :datetime, precision: 6
+ t.column :updated_on, :datetime, precision: 6
+ else
+ t.column :created_on, :datetime
+ t.column :updated_on, :datetime
+ end
end
create_table :posts, force: true do |t|
@@ -700,7 +716,11 @@ ActiveRecord::Schema.define do
create_table :ship_parts, force: true do |t|
t.string :name
t.integer :ship_id
- t.datetime :updated_at, precision: 6
+ if subsecond_precision_supported?
+ t.datetime :updated_at, precision: 6
+ else
+ t.datetime :updated_at
+ end
end
create_table :prisoners, force: true do |t|