From 100270703f06e7fa1f12ee8bb6aee297c56ce49b Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 29 Jan 2018 21:20:46 -0500 Subject: Updated pokeviewer (Pokédex) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..._create_pokeviewer_pokedex_entries.pokeviewer.rb | 21 +++++++++++++++++++++ db/schema.rb | 15 ++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20180130021851_create_pokeviewer_pokedex_entries.pokeviewer.rb (limited to 'db') diff --git a/db/migrate/20180130021851_create_pokeviewer_pokedex_entries.pokeviewer.rb b/db/migrate/20180130021851_create_pokeviewer_pokedex_entries.pokeviewer.rb new file mode 100644 index 0000000..2451ef2 --- /dev/null +++ b/db/migrate/20180130021851_create_pokeviewer_pokedex_entries.pokeviewer.rb @@ -0,0 +1,21 @@ +# This migration comes from pokeviewer (originally 20180129213822) +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_trainers, + 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 diff --git a/db/schema.rb b/db/schema.rb index f4243a4..868f6f6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180114181813) do +ActiveRecord::Schema.define(version: 20180130021851) do create_table "ckeditor_assets", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| t.string "data_file_name", null: false @@ -78,6 +78,17 @@ ActiveRecord::Schema.define(version: 20180114181813) do t.index ["name"], name: "index_pokeviewer_moves_on_name", unique: true end + create_table "pokeviewer_pokedex_entries", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| + t.bigint "trainer_id" + t.bigint "species_id" + t.boolean "caught", default: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["species_id"], name: "index_pokeviewer_pokedex_entries_on_species_id" + t.index ["trainer_id", "species_id"], name: "index_pokeviewer_pokedex_entries_on_trainer_id_and_species_id", unique: true + t.index ["trainer_id"], name: "index_pokeviewer_pokedex_entries_on_trainer_id" + end + create_table "pokeviewer_pokemon", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| t.string "uuid", null: false t.integer "trainer_id" @@ -239,6 +250,8 @@ ActiveRecord::Schema.define(version: 20180114181813) do t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true end + add_foreign_key "pokeviewer_pokedex_entries", "pokeviewer_species", column: "species_id" + add_foreign_key "pokeviewer_pokedex_entries", "pokeviewer_trainers", column: "trainer_id" add_foreign_key "pokeviewer_pokemon", "pokeviewer_revisions", column: "current_id" add_foreign_key "pokeviewer_revisions", "pokeviewer_species", column: "species_id" end -- cgit 1.4.1