Commit 870dd2e9 by ivan Lan

Fix migration to pass the rubocop

parent 04b35280
class CreateShotengaiProductsAndOrders < ActiveRecord::Migration[5.1] class CreateShotengaiProductsAndOrders < ActiveRecord::Migration[5.1]
def change def change
create_product
create_series
create_order
create_snapshot
end
def create_product
create_table :shotengai_products do |t| create_table :shotengai_products do |t|
t.string :title t.string :title
t.string :status t.string :status
...@@ -22,7 +29,9 @@ class CreateShotengaiProductsAndOrders < ActiveRecord::Migration[5.1] ...@@ -22,7 +29,9 @@ class CreateShotengaiProductsAndOrders < ActiveRecord::Migration[5.1]
add_index :shotengai_products, [:manager_id, :manager_type] add_index :shotengai_products, [:manager_id, :manager_type]
add_index :shotengai_products, :type add_index :shotengai_products, :type
end
def create_series
create_table :shotengai_series do |t| create_table :shotengai_series do |t|
t.decimal :original_price, precision: 9, scale: 2 t.decimal :original_price, precision: 9, scale: 2
t.decimal :price, precision: 9, scale: 2 t.decimal :price, precision: 9, scale: 2
...@@ -38,7 +47,9 @@ class CreateShotengaiProductsAndOrders < ActiveRecord::Migration[5.1] ...@@ -38,7 +47,9 @@ class CreateShotengaiProductsAndOrders < ActiveRecord::Migration[5.1]
end end
add_index :shotengai_series, :type add_index :shotengai_series, :type
end
def create_order
create_table :shotengai_orders do |t| create_table :shotengai_orders do |t|
t.integer :seq t.integer :seq
t.string :address t.string :address
...@@ -62,7 +73,9 @@ class CreateShotengaiProductsAndOrders < ActiveRecord::Migration[5.1] ...@@ -62,7 +73,9 @@ class CreateShotengaiProductsAndOrders < ActiveRecord::Migration[5.1]
add_index :shotengai_orders, :type add_index :shotengai_orders, :type
add_index :shotengai_orders, [:buyer_id, :buyer_type] add_index :shotengai_orders, [:buyer_id, :buyer_type]
end
def create_snapshot
create_table :shotengai_snapshots do |t| create_table :shotengai_snapshots do |t|
t.decimal :original_price, precision: 9, scale: 2 t.decimal :original_price, precision: 9, scale: 2
t.decimal :price, precision: 9, scale: 2 t.decimal :price, precision: 9, scale: 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment