Skip to content

Commit

Permalink
MySQL migrations timestamp precision fix
Browse files Browse the repository at this point in the history
  • Loading branch information
damianlegawiec committed Nov 8, 2018
1 parent 239c802 commit 633f35f
Show file tree
Hide file tree
Showing 22 changed files with 57 additions and 57 deletions.
72 changes: 36 additions & 36 deletions core/db/migrate/20120831092320_spree_one_two.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def up
t.string :code
t.boolean :advertise, default: false
t.string :path
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_addresses do |t|
Expand All @@ -34,7 +34,7 @@ def up
t.string :company
t.references :state
t.references :country
t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_addresses, [:firstname], name: 'index_addresses_on_firstname'
Expand All @@ -49,7 +49,7 @@ def up
t.boolean :mandatory
t.boolean :locked
t.boolean :eligible, default: true
t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_adjustments, [:adjustable_id], name: 'index_adjustments_on_order_id'
Expand All @@ -73,13 +73,13 @@ def up
create_table :spree_calculators do |t|
t.string :type
t.references :calculable, polymorphic: true
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_configurations do |t|
t.string :name
t.string :type, limit: 50
t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_configurations, [:name, :type], name: 'index_spree_configurations_on_name_and_type'
Expand All @@ -105,7 +105,7 @@ def up
t.references :address
t.string :gateway_customer_profile_id
t.string :gateway_payment_profile_id
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_gateways do |t|
Expand All @@ -116,7 +116,7 @@ def up
t.string :environment, default: 'development'
t.string :server, default: 'test'
t.boolean :test_mode, default: true
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_inventory_units do |t|
Expand All @@ -126,7 +126,7 @@ def up
t.references :order
t.references :shipment
t.references :return_authorization
t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_inventory_units, [:order_id], name: 'index_inventory_units_on_order_id'
Expand All @@ -138,7 +138,7 @@ def up
t.references :order
t.integer :quantity, null: false
t.decimal :price, precision: 8, scale: 2, null: false
t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_line_items, [:order_id], name: 'index_spree_line_items_on_order_id'
Expand All @@ -147,20 +147,20 @@ def up
create_table :spree_log_entries do |t|
t.references :source, polymorphic: true
t.text :details
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_mail_methods do |t|
t.string :environment
t.boolean :active, default: true
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_option_types do |t|
t.string :name, limit: 100
t.string :presentation, limit: 100
t.integer :position, default: 0, null: false
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_option_types_prototypes, id: false do |t|
Expand All @@ -173,7 +173,7 @@ def up
t.string :name
t.string :presentation
t.references :option_type
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_option_values_variants, id: false do |t|
Expand All @@ -200,7 +200,7 @@ def up
t.string :payment_state
t.string :email
t.text :special_instructions
t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_orders, [:number], name: 'index_spree_orders_on_number'
Expand All @@ -213,7 +213,7 @@ def up
t.string :environment, default: 'development'
t.datetime :deleted_at
t.string :display_on
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_payments do |t|
Expand All @@ -224,7 +224,7 @@ def up
t.string :state
t.string :response_code
t.string :avs_response
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_preferences do |t|
Expand All @@ -233,7 +233,7 @@ def up
t.text :value
t.string :key
t.string :value_type
t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_preferences, [:key], name: 'index_spree_preferences_on_key', unique: true
Expand All @@ -242,14 +242,14 @@ def up
t.integer :position
t.references :product
t.references :option_type
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_product_properties do |t|
t.string :value
t.references :product
t.references :property
t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_product_properties, [:product_id], name: 'index_product_properties_on_product_id'
Expand All @@ -265,7 +265,7 @@ def up
t.references :tax_category
t.references :shipping_category
t.integer :count_on_hand, default: 0, null: false
t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_products, [:available_on], name: 'index_spree_products_on_available_on'
Expand All @@ -284,7 +284,7 @@ def up
create_table :spree_properties do |t|
t.string :name
t.string :presentation, null: false
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_properties_prototypes, id: false do |t|
Expand All @@ -294,7 +294,7 @@ def up

create_table :spree_prototypes do |t|
t.string :name
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_return_authorizations do |t|
Expand All @@ -303,7 +303,7 @@ def up
t.decimal :amount, precision: 8, scale: 2, default: 0.0, null: false
t.references :order
t.text :reason
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_roles do |t|
Expand All @@ -327,14 +327,14 @@ def up
t.references :shipping_method
t.references :address
t.string :state
t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_shipments, [:number], name: 'index_shipments_on_number'

create_table :spree_shipping_categories do |t|
t.string :name
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_shipping_methods do |t|
Expand All @@ -346,7 +346,7 @@ def up
t.boolean :match_all
t.boolean :match_one
t.datetime :deleted_at
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_state_changes do |t|
Expand All @@ -356,7 +356,7 @@ def up
t.references :user
t.string :stateful_type
t.string :next_state
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_states do |t|
Expand All @@ -370,20 +370,20 @@ def up
t.string :description
t.boolean :is_default, default: false
t.datetime :deleted_at
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_tax_rates do |t|
t.decimal :amount, precision: 8, scale: 5
t.references :zone
t.references :tax_category
t.boolean :included_in_price, default: false
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_taxonomies do |t|
t.string :name, null: false
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_taxons do |t|
Expand All @@ -399,7 +399,7 @@ def up
t.integer :icon_file_size
t.datetime :icon_updated_at
t.text :description
t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_taxons, [:parent_id], name: 'index_taxons_on_parent_id'
Expand All @@ -409,7 +409,7 @@ def up
create_table :spree_tokenized_permissions, force: true do |t|
t.references :permissable, polymorphic: true
t.string :token
t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_tokenized_permissions, [:permissable_id, :permissable_type], name: 'index_tokenized_name_and_type'
Expand All @@ -418,7 +418,7 @@ def up
t.string :environment
t.string :analytics_id
t.boolean :active, default: true
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_users do |t|
Expand All @@ -444,7 +444,7 @@ def up
t.datetime :locked_at
t.datetime :remember_created_at
t.datetime :reset_password_sent_at
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_variants do |t|
Expand All @@ -467,15 +467,15 @@ def up
create_table :spree_zone_members do |t|
t.references :zoneable, polymorphic: true
t.references :zone
t.timestamps null: false
t.timestamps null: false, precision: 6
end

create_table :spree_zones do |t|
t.string :name
t.string :description
t.boolean :default_tax, default: false
t.integer :zone_members_count, default: 0
t.timestamps null: false
t.timestamps null: false, precision: 6
end
end
end
2 changes: 1 addition & 1 deletion core/db/migrate/20120831092359_spree_promo_one_two.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def up
t.references :user
t.references :product_group
t.string :type
t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_promotion_rules, [:product_group_id], name: 'index_promotion_rules_on_product_group_id'
Expand Down
2 changes: 1 addition & 1 deletion core/db/migrate/20130211190146_create_spree_stock_items.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def change
t.integer :count_on_hand, null: false, default: 0
t.integer :lock_version

t.timestamps null: false
t.timestamps null: false, precision: 6
end
add_index :spree_stock_items, :stock_location_id
add_index :spree_stock_items, [:stock_location_id, :variant_id], name: 'stock_item_by_loc_and_var_id'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def change
t.string :name
t.belongs_to :address

t.timestamps null: false
t.timestamps null: false, precision: 6
end
add_index :spree_stock_locations, :address_id
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def change
t.integer :shipping_method_id, null: false
t.integer :shipping_category_id, null: false

t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_shipping_method_categories, :shipping_method_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def up
t.belongs_to :shipping_method
t.boolean :selected, default: false
t.decimal :cost, precision: 8, scale: 2
t.timestamps null: false
t.timestamps null: false, precision: 6
end
add_index(:spree_shipping_rates, [:shipment_id, :shipping_method_id],
name: 'spree_shipping_rates_join_index',
Expand Down
2 changes: 1 addition & 1 deletion core/db/migrate/20130305143310_create_stock_movements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def change
t.integer :quantity
t.string :action

t.timestamps null: false
t.timestamps null: false, precision: 6
end
add_index :spree_stock_movements, :stock_item_id
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def change
t.string :reference_number
t.integer :source_location_id
t.integer :destination_location_id
t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_stock_transfers, :source_location_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def change
t.decimal :amount, precision: 10, scale: 2, default: 0.0
t.integer :payment_id

t.timestamps null: false
t.timestamps null: false, precision: 6
end

add_index :spree_payment_capture_events, :payment_id
Expand Down
2 changes: 1 addition & 1 deletion core/db/migrate/20140309024355_create_spree_stores.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def change
t.string :code
t.boolean :default, default: false, null: false

t.timestamps null: false
t.timestamps null: false, precision: 6
end
end
end
Expand Down
Loading

0 comments on commit 633f35f

Please sign in to comment.