about summary refs log tree commit diff stats
path: root/db/migrate
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-01-29 21:13:35 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-01-29 21:13:35 -0500
commit5ade37d852bd1e96f9451ab98619359a5a048cee (patch)
tree251c6bf7c24b7be69b2e908590a733a808165e4c /db/migrate
parent30cd66e1521bc760df45908adb2f7d3ba6683900 (diff)
downloadpokeviewer-5ade37d852bd1e96f9451ab98619359a5a048cee.tar.gz
pokeviewer-5ade37d852bd1e96f9451ab98619359a5a048cee.tar.bz2
pokeviewer-5ade37d852bd1e96f9451ab98619359a5a048cee.zip
Added Pokédex viewing page
Currently a work in progress. The queries used to display the Pokémon for each species are very inefficient. The text at the top of the page is also very specific to the author.
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20180129213822_create_pokeviewer_pokedex_entries.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20180129213822_create_pokeviewer_pokedex_entries.rb b/db/migrate/20180129213822_create_pokeviewer_pokedex_entries.rb new file mode 100644 index 0000000..99ac4f6 --- /dev/null +++ b/db/migrate/20180129213822_create_pokeviewer_pokedex_entries.rb
@@ -0,0 +1,20 @@
1class CreatePokeviewerPokedexEntries < ActiveRecord::Migration[5.1]
2 def change
3 create_table :pokeviewer_pokedex_entries do |t|
4 t.references :trainer, null: true
5 t.references :species, null: true
6 t.boolean :caught, null: true, default: false
7
8 t.timestamps
9 end
10
11 add_foreign_key :pokeviewer_pokedex_entries, :pokeviewer_trainer,
12 column: :trainer_id
13
14 add_foreign_key :pokeviewer_pokedex_entries, :pokeviewer_species,
15 column: :species_id
16
17 add_index :pokeviewer_pokedex_entries, [:trainer_id, :species_id],
18 unique: true
19 end
20end