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
def change
create_table :units do |t|
t.references :project, index: true, foreign_key: true
t.references :project
t.string :name
t.string :shortname
end
add_index :units, :project_id
create_table :quantities do |t|
t.references :project, index: true, foreign_key: true
t.references :project
t.string :name
t.string :description
t.integer :domain
end
add_index :quantities, :project_id
create_table :ingredients do |t|
t.string :name
t.references :ref_unit, index: true, foreign_key: true
t.references :ref_unit
t.decimal :ref_amount
t.boolean :hidden
t.references :source, index: true, foreign_key: true
t.references :source
t.integer :group
end
add_index :ingredients, :ref_unit_id
add_index :ingredients, :source_id
reversible do |dir|
dir.up do