From 5ade37d852bd1e96f9451ab98619359a5a048cee Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 29 Jan 2018 21:13:35 -0500 Subject: Added Pokédex viewing page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- ...180129213822_create_pokeviewer_pokedex_entries.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 db/migrate/20180129213822_create_pokeviewer_pokedex_entries.rb (limited to 'db/migrate/20180129213822_create_pokeviewer_pokedex_entries.rb') 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 @@ +class CreatePokeviewerPokedexEntries < ActiveRecord::Migration[5.1] + def change + create_table :pokeviewer_pokedex_entries do |t| + t.references :trainer, null: true + t.references :species, null: true + t.boolean :caught, null: true, default: false + + t.timestamps + end + + add_foreign_key :pokeviewer_pokedex_entries, :pokeviewer_trainer, + column: :trainer_id + + add_foreign_key :pokeviewer_pokedex_entries, :pokeviewer_species, + column: :species_id + + add_index :pokeviewer_pokedex_entries, [:trainer_id, :species_id], + unique: true + end +end -- cgit 1.4.1