1
0

Fixed migration

This commit is contained in:
cryptogopher 2019-08-28 21:22:43 +02:00
parent b63040b037
commit 96509d5285

View File

@ -1,30 +1,26 @@
class CreateUnits < ActiveRecord::Migration class CreateUnits < ActiveRecord::Migration
def change def change
create_table :units do |t| create_table :units do |t|
t.references :project, index: true, foreign_key: true t.references :project
t.string :name t.string :name
t.string :shortname t.string :shortname
end end
add_index :units, :project_id
create_table :quantities do |t| create_table :quantities do |t|
t.references :project, index: true, foreign_key: true t.references :project
t.string :name t.string :name
t.string :description t.string :description
t.integer :domain t.integer :domain
end end
add_index :quantities, :project_id
create_table :ingredients do |t| create_table :ingredients do |t|
t.string :name t.string :name
t.references :ref_unit, index: true, foreign_key: true t.references :ref_unit
t.decimal :ref_amount t.decimal :ref_amount
t.boolean :hidden t.boolean :hidden
t.references :source, index: true, foreign_key: true t.references :source
t.integer :group t.integer :group
end end
add_index :ingredients, :ref_unit_id
add_index :ingredients, :source_id
reversible do |dir| reversible do |dir|
dir.up do dir.up do