foodsoft/db/migrate/009_create_order_results.rb
Philipp Rothmann fb2b4d8a8a chore: rubocop
chore: fix api test conventions

chore: rubocop -A spec/

chore: more rubocop -A

fix failing test

rubocop fixes

removes helper methods that are in my opinion dead code

more rubocop fixes

rubocop -a --auto-gen-config
2023-06-09 17:35:05 +02:00

41 lines
1.6 KiB
Ruby

class CreateOrderResults < ActiveRecord::Migration[4.2]
def self.up
create_table :group_order_results do |t|
t.column :order_id, :int, null: false
t.column :group_name, :string, null: false
t.column :price, :decimal, precision: 8, scale: 2, null: false, default: 0
end
add_index(:group_order_results, %i[group_name order_id], unique: true)
create_table :order_article_results do |t|
t.column :order_id, :int, null: false
t.column :name, :string, null: false
t.column :unit, :string, null: false
t.column :note, :string
t.column :clear_price, :decimal, precision: 8, scale: 2, null: false
t.column :gross_price, :decimal, precision: 8, scale: 2, null: false
t.column :tax, :float, null: false, default: 0
t.column :refund, :decimal, precision: 8, scale: 2
t.column :fc_markup, :float, null: false
t.column :order_number, :string
t.column :unit_quantity, :int, null: false
t.column :units_to_order, :int, null: false
end
add_index(:order_article_results, :order_id)
create_table :group_order_article_results do |t|
t.column :order_article_result_id, :int, null: false
t.column :group_order_result_id, :int, null: false
t.column :quantity, :int, null: false
t.column :tolerance, :int
end
add_index(:group_order_article_results, :order_article_result_id)
add_index(:group_order_article_results, :group_order_result_id)
end
def self.down
drop_table :group_order_results
drop_table :order_article_results
drop_table :group_order_article_results
end
end