about summary refs log tree commit diff stats
path: root/db/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20170929221317_create_pokeviewer_gift_ribbons.rb9
-rw-r--r--db/migrate/20170930021856_add_gift_ribbons_to_trainer.rb34
2 files changed, 43 insertions, 0 deletions
diff --git a/db/migrate/20170929221317_create_pokeviewer_gift_ribbons.rb b/db/migrate/20170929221317_create_pokeviewer_gift_ribbons.rb new file mode 100644 index 0000000..deedc80 --- /dev/null +++ b/db/migrate/20170929221317_create_pokeviewer_gift_ribbons.rb
@@ -0,0 +1,9 @@
1class CreatePokeviewerGiftRibbons < ActiveRecord::Migration[5.1]
2 def change
3 create_table :pokeviewer_gift_ribbons do |t|
4 t.string :description, null: false
5
6 t.timestamps
7 end
8 end
9end
diff --git a/db/migrate/20170930021856_add_gift_ribbons_to_trainer.rb b/db/migrate/20170930021856_add_gift_ribbons_to_trainer.rb new file mode 100644 index 0000000..2a5f9b3 --- /dev/null +++ b/db/migrate/20170930021856_add_gift_ribbons_to_trainer.rb
@@ -0,0 +1,34 @@
1class AddGiftRibbonsToTrainer < ActiveRecord::Migration[5.1]
2 def change
3 change_table :pokeviewer_trainers do |t|
4 t.references :marine_ribbon, null: true
5 t.references :land_ribbon, null: true
6 t.references :sky_ribbon, null: true
7 t.references :country_ribbon, null: true
8 t.references :national_ribbon, null: true
9 t.references :earth_ribbon, null: true
10 t.references :world_ribbon, null: true
11 end
12
13 add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
14 column: :marine_ribbon_id
15
16 add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
17 column: :land_ribbon_id
18
19 add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
20 column: :sky_ribbon_id
21
22 add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
23 column: :country_ribbon_id
24
25 add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
26 column: :national_ribbon_id
27
28 add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
29 column: :earth_ribbon_id
30
31 add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
32 column: :world_ribbon_id
33 end
34end