diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20180130021851_create_pokeviewer_pokedex_entries.pokeviewer.rb | 21 | ||||
-rw-r--r-- | db/schema.rb | 15 |
2 files changed, 35 insertions, 1 deletions
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 @@ | |||
1 | # This migration comes from pokeviewer (originally 20180129213822) | ||
2 | class CreatePokeviewerPokedexEntries < ActiveRecord::Migration[5.1] | ||
3 | def change | ||
4 | create_table :pokeviewer_pokedex_entries do |t| | ||
5 | t.references :trainer, null: true | ||
6 | t.references :species, null: true | ||
7 | t.boolean :caught, null: true, default: false | ||
8 | |||
9 | t.timestamps | ||
10 | end | ||
11 | |||
12 | add_foreign_key :pokeviewer_pokedex_entries, :pokeviewer_trainers, | ||
13 | column: :trainer_id | ||
14 | |||
15 | add_foreign_key :pokeviewer_pokedex_entries, :pokeviewer_species, | ||
16 | column: :species_id | ||
17 | |||
18 | add_index :pokeviewer_pokedex_entries, [:trainer_id, :species_id], | ||
19 | unique: true | ||
20 | end | ||
21 | 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 @@ | |||
10 | # | 10 | # |
11 | # It's strongly recommended that you check this file into your version control system. | 11 | # It's strongly recommended that you check this file into your version control system. |
12 | 12 | ||
13 | ActiveRecord::Schema.define(version: 20180114181813) do | 13 | ActiveRecord::Schema.define(version: 20180130021851) do |
14 | 14 | ||
15 | create_table "ckeditor_assets", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| | 15 | create_table "ckeditor_assets", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
16 | t.string "data_file_name", null: false | 16 | t.string "data_file_name", null: false |
@@ -78,6 +78,17 @@ ActiveRecord::Schema.define(version: 20180114181813) do | |||
78 | t.index ["name"], name: "index_pokeviewer_moves_on_name", unique: true | 78 | t.index ["name"], name: "index_pokeviewer_moves_on_name", unique: true |
79 | end | 79 | end |
80 | 80 | ||
81 | create_table "pokeviewer_pokedex_entries", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| | ||
82 | t.bigint "trainer_id" | ||
83 | t.bigint "species_id" | ||
84 | t.boolean "caught", default: false | ||
85 | t.datetime "created_at", null: false | ||
86 | t.datetime "updated_at", null: false | ||
87 | t.index ["species_id"], name: "index_pokeviewer_pokedex_entries_on_species_id" | ||
88 | t.index ["trainer_id", "species_id"], name: "index_pokeviewer_pokedex_entries_on_trainer_id_and_species_id", unique: true | ||
89 | t.index ["trainer_id"], name: "index_pokeviewer_pokedex_entries_on_trainer_id" | ||
90 | end | ||
91 | |||
81 | create_table "pokeviewer_pokemon", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| | 92 | create_table "pokeviewer_pokemon", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
82 | t.string "uuid", null: false | 93 | t.string "uuid", null: false |
83 | t.integer "trainer_id" | 94 | t.integer "trainer_id" |
@@ -239,6 +250,8 @@ ActiveRecord::Schema.define(version: 20180114181813) do | |||
239 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true | 250 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true |
240 | end | 251 | end |
241 | 252 | ||
253 | add_foreign_key "pokeviewer_pokedex_entries", "pokeviewer_species", column: "species_id" | ||
254 | add_foreign_key "pokeviewer_pokedex_entries", "pokeviewer_trainers", column: "trainer_id" | ||
242 | add_foreign_key "pokeviewer_pokemon", "pokeviewer_revisions", column: "current_id" | 255 | add_foreign_key "pokeviewer_pokemon", "pokeviewer_revisions", column: "current_id" |
243 | add_foreign_key "pokeviewer_revisions", "pokeviewer_species", column: "species_id" | 256 | add_foreign_key "pokeviewer_revisions", "pokeviewer_species", column: "species_id" |
244 | end | 257 | end |