scinote-web/db/migrate/20150716062801_create_samples.rb

18 lines
419 B
Ruby
Raw Normal View History

2017-06-30 16:23:28 +08:00
class CreateSamples < ActiveRecord::Migration[4.2]
2016-02-12 23:52:43 +08:00
def change
create_table :samples do |t|
t.string :name, null: false
# Foreign keys
t.integer :user_id, null: false
2017-01-26 23:30:31 +08:00
t.integer :team_id, null: false
2016-02-12 23:52:43 +08:00
t.timestamps null: false
end
add_foreign_key :samples, :users
2017-01-26 23:30:31 +08:00
add_foreign_key :samples, :teams
2016-02-12 23:52:43 +08:00
add_index :samples, :user_id
2017-01-26 23:30:31 +08:00
add_index :samples, :team_id
2016-02-12 23:52:43 +08:00
end
end