about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-01-13 16:19:36 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-01-13 16:19:36 -0500
commit0bfb8ae3ec6348664c4625df89b252193aa14725 (patch)
tree36b7c44541f1bd933cbdc95e112ab69bc22b49d4
parent0b0f8509452c7206e52e8ce2c47a8f54d88f652c (diff)
downloadthoughts-0bfb8ae3ec6348664c4625df89b252193aa14725.tar.gz
thoughts-0bfb8ae3ec6348664c4625df89b252193aa14725.tar.bz2
thoughts-0bfb8ae3ec6348664c4625df89b252193aa14725.zip
Actually added migration from previous commit
-rw-r--r--db/migrate/20180113211911_move_species_to_revision.pokeviewer.rb40
-rw-r--r--db/schema.rb55
2 files changed, 68 insertions, 27 deletions
diff --git a/db/migrate/20180113211911_move_species_to_revision.pokeviewer.rb b/db/migrate/20180113211911_move_species_to_revision.pokeviewer.rb new file mode 100644 index 0000000..bd19f21 --- /dev/null +++ b/db/migrate/20180113211911_move_species_to_revision.pokeviewer.rb
@@ -0,0 +1,40 @@
1# This migration comes from pokeviewer (originally 20180113200119)
2class MoveSpeciesToRevision < ActiveRecord::Migration[5.1]
3 def up
4 change_table :pokeviewer_revisions do |t|
5 t.references :species, null: true
6 end
7
8 Pokeviewer::Revision.all.each do |r|
9 r.species_id = r.pokemon.species_id
10 r.save!
11 end
12
13 remove_column :pokeviewer_pokemon, :species_id
14
15 change_column_null :pokeviewer_revisions, :species_id, false
16
17 add_foreign_key :pokeviewer_revisions, :pokeviewer_species,
18 column: :species_id
19 end
20
21 def down
22 def up
23 change_table :pokeviewer_pokemon do |t|
24 t.references :species, null: true
25 end
26
27 Pokeviewer::Pokemon.all.each do |p|
28 p.species_id = p.revisions.first.species_id
29 p.save!
30 end
31
32 remove_column :pokeviewer_revisions, :species_id
33
34 change_column_null :pokeviewer_pokemon, :species_id, false
35
36 add_foreign_key :pokeviewer_pokemon, :pokeviewer_species,
37 column: :species_id
38 end
39 end
40end
diff --git a/db/schema.rb b/db/schema.rb index ede1db3..7a7be14 100644 --- a/db/schema.rb +++ b/db/schema.rb
@@ -10,9 +10,9 @@
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
13ActiveRecord::Schema.define(version: 20171015171559) do 13ActiveRecord::Schema.define(version: 20180113211911) do
14 14
15 create_table "ckeditor_assets", force: :cascade 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
17 t.string "data_content_type" 17 t.string "data_content_type"
18 t.integer "data_file_size" 18 t.integer "data_file_size"
@@ -25,7 +25,7 @@ ActiveRecord::Schema.define(version: 20171015171559) do
25 t.index ["type"], name: "index_ckeditor_assets_on_type" 25 t.index ["type"], name: "index_ckeditor_assets_on_type"
26 end 26 end
27 27
28 create_table "entries", force: :cascade do |t| 28 create_table "entries", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
29 t.string "title" 29 t.string "title"
30 t.text "body" 30 t.text "body"
31 t.string "slug", null: false 31 t.string "slug", null: false
@@ -34,21 +34,21 @@ ActiveRecord::Schema.define(version: 20171015171559) do
34 t.datetime "updated_at", null: false 34 t.datetime "updated_at", null: false
35 end 35 end
36 36
37 create_table "pokeviewer_abilities", force: :cascade do |t| 37 create_table "pokeviewer_abilities", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
38 t.string "name", limit: 191, null: false 38 t.string "name", null: false
39 t.string "description", null: false 39 t.string "description", null: false
40 t.datetime "created_at", null: false 40 t.datetime "created_at", null: false
41 t.datetime "updated_at", null: false 41 t.datetime "updated_at", null: false
42 t.index ["name"], name: "index_pokeviewer_abilities_on_name", unique: true 42 t.index ["name"], name: "index_pokeviewer_abilities_on_name", unique: true
43 end 43 end
44 44
45 create_table "pokeviewer_gift_ribbons", force: :cascade do |t| 45 create_table "pokeviewer_gift_ribbons", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
46 t.string "description", null: false 46 t.string "description", null: false
47 t.datetime "created_at", null: false 47 t.datetime "created_at", null: false
48 t.datetime "updated_at", null: false 48 t.datetime "updated_at", null: false
49 end 49 end
50 50
51 create_table "pokeviewer_items", force: :cascade do |t| 51 create_table "pokeviewer_items", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
52 t.string "name", null: false 52 t.string "name", null: false
53 t.boolean "tm", default: false, null: false 53 t.boolean "tm", default: false, null: false
54 t.integer "move_id" 54 t.integer "move_id"
@@ -60,14 +60,14 @@ ActiveRecord::Schema.define(version: 20171015171559) do
60 t.index ["move_id"], name: "index_pokeviewer_items_on_move_id" 60 t.index ["move_id"], name: "index_pokeviewer_items_on_move_id"
61 end 61 end
62 62
63 create_table "pokeviewer_locations", force: :cascade do |t| 63 create_table "pokeviewer_locations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
64 t.string "name", null: false 64 t.string "name", null: false
65 t.datetime "created_at", null: false 65 t.datetime "created_at", null: false
66 t.datetime "updated_at", null: false 66 t.datetime "updated_at", null: false
67 end 67 end
68 68
69 create_table "pokeviewer_moves", force: :cascade do |t| 69 create_table "pokeviewer_moves", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
70 t.string "name", limit: 191, null: false 70 t.string "name", null: false
71 t.integer "pp", null: false 71 t.integer "pp", null: false
72 t.datetime "created_at", null: false 72 t.datetime "created_at", null: false
73 t.datetime "updated_at", null: false 73 t.datetime "updated_at", null: false
@@ -78,11 +78,10 @@ ActiveRecord::Schema.define(version: 20171015171559) 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_pokemon", force: :cascade do |t| 81 create_table "pokeviewer_pokemon", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
82 t.string "uuid", limit: 191, null: false 82 t.string "uuid", null: false
83 t.integer "species_id", null: false
84 t.integer "trainer_id" 83 t.integer "trainer_id"
85 t.string "key", limit: 191 84 t.string "key"
86 t.string "ot_name", null: false 85 t.string "ot_name", null: false
87 t.integer "ot_number", null: false 86 t.integer "ot_number", null: false
88 t.string "met_type", null: false 87 t.string "met_type", null: false
@@ -100,12 +99,11 @@ ActiveRecord::Schema.define(version: 20171015171559) do
100 t.integer "location_id" 99 t.integer "location_id"
101 t.string "pokeball", null: false 100 t.string "pokeball", null: false
102 t.index ["key"], name: "index_pokeviewer_pokemon_on_key", unique: true 101 t.index ["key"], name: "index_pokeviewer_pokemon_on_key", unique: true
103 t.index ["species_id"], name: "index_pokeviewer_pokemon_on_species_id"
104 t.index ["trainer_id"], name: "index_pokeviewer_pokemon_on_trainer_id" 102 t.index ["trainer_id"], name: "index_pokeviewer_pokemon_on_trainer_id"
105 t.index ["uuid"], name: "index_pokeviewer_pokemon_on_uuid", unique: true 103 t.index ["uuid"], name: "index_pokeviewer_pokemon_on_uuid", unique: true
106 end 104 end
107 105
108 create_table "pokeviewer_revisions", force: :cascade do |t| 106 create_table "pokeviewer_revisions", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
109 t.integer "pokemon_id", null: false 107 t.integer "pokemon_id", null: false
110 t.integer "sequential_id", null: false 108 t.integer "sequential_id", null: false
111 t.string "nickname", null: false 109 t.string "nickname", null: false
@@ -151,16 +149,18 @@ ActiveRecord::Schema.define(version: 20171015171559) do
151 t.boolean "national_ribbon", default: false 149 t.boolean "national_ribbon", default: false
152 t.boolean "earth_ribbon", default: false 150 t.boolean "earth_ribbon", default: false
153 t.boolean "world_ribbon", default: false 151 t.boolean "world_ribbon", default: false
152 t.bigint "species_id", null: false
154 t.index ["move_1_id"], name: "index_pokeviewer_revisions_on_move_1_id" 153 t.index ["move_1_id"], name: "index_pokeviewer_revisions_on_move_1_id"
155 t.index ["move_2_id"], name: "index_pokeviewer_revisions_on_move_2_id" 154 t.index ["move_2_id"], name: "index_pokeviewer_revisions_on_move_2_id"
156 t.index ["move_3_id"], name: "index_pokeviewer_revisions_on_move_3_id" 155 t.index ["move_3_id"], name: "index_pokeviewer_revisions_on_move_3_id"
157 t.index ["move_4_id"], name: "index_pokeviewer_revisions_on_move_4_id" 156 t.index ["move_4_id"], name: "index_pokeviewer_revisions_on_move_4_id"
158 t.index ["pokemon_id", "sequential_id"], name: "index_pokeviewer_revisions_on_pokemon_id_and_sequential_id", unique: true 157 t.index ["pokemon_id", "sequential_id"], name: "index_pokeviewer_revisions_on_pokemon_id_and_sequential_id", unique: true
159 t.index ["pokemon_id"], name: "index_pokeviewer_revisions_on_pokemon_id" 158 t.index ["pokemon_id"], name: "index_pokeviewer_revisions_on_pokemon_id"
159 t.index ["species_id"], name: "index_pokeviewer_revisions_on_species_id"
160 end 160 end
161 161
162 create_table "pokeviewer_species", force: :cascade do |t| 162 create_table "pokeviewer_species", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
163 t.string "name", limit: 191, null: false 163 t.string "name", null: false
164 t.datetime "created_at", null: false 164 t.datetime "created_at", null: false
165 t.datetime "updated_at", null: false 165 t.datetime "updated_at", null: false
166 t.string "type_1", null: false 166 t.string "type_1", null: false
@@ -170,9 +170,9 @@ ActiveRecord::Schema.define(version: 20171015171559) do
170 t.index ["name"], name: "index_pokeviewer_species_on_name", unique: true 170 t.index ["name"], name: "index_pokeviewer_species_on_name", unique: true
171 end 171 end
172 172
173 create_table "pokeviewer_trainers", force: :cascade do |t| 173 create_table "pokeviewer_trainers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
174 t.string "game", null: false 174 t.string "game", null: false
175 t.string "name", limit: 191, null: false 175 t.string "name", null: false
176 t.integer "number", null: false 176 t.integer "number", null: false
177 t.datetime "created_at", null: false 177 t.datetime "created_at", null: false
178 t.datetime "updated_at", null: false 178 t.datetime "updated_at", null: false
@@ -207,20 +207,20 @@ ActiveRecord::Schema.define(version: 20171015171559) do
207 t.index ["world_ribbon_id"], name: "index_pokeviewer_trainers_on_world_ribbon_id" 207 t.index ["world_ribbon_id"], name: "index_pokeviewer_trainers_on_world_ribbon_id"
208 end 208 end
209 209
210 create_table "records", force: :cascade do |t| 210 create_table "records", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
211 t.text "description" 211 t.text "description"
212 t.string "recordable_type", limit: 191 212 t.string "recordable_type"
213 t.integer "recordable_id" 213 t.integer "recordable_id"
214 t.datetime "created_at", null: false 214 t.datetime "created_at", null: false
215 t.datetime "updated_at", null: false 215 t.datetime "updated_at", null: false
216 t.index ["recordable_type", "recordable_id"], name: "index_records_on_recordable_type_and_recordable_id" 216 t.index ["recordable_type", "recordable_id"], name: "index_records_on_recordable_type_and_recordable_id"
217 end 217 end
218 218
219 create_table "users", force: :cascade do |t| 219 create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t|
220 t.string "login", limit: 191, default: "", null: false 220 t.string "login", default: "", null: false
221 t.string "email", limit: 191, default: "", null: false 221 t.string "email", default: "", null: false
222 t.string "encrypted_password", default: "", null: false 222 t.string "encrypted_password", default: "", null: false
223 t.string "reset_password_token", limit: 191 223 t.string "reset_password_token"
224 t.datetime "reset_password_sent_at" 224 t.datetime "reset_password_sent_at"
225 t.datetime "remember_created_at" 225 t.datetime "remember_created_at"
226 t.integer "sign_in_count", default: 0, null: false 226 t.integer "sign_in_count", default: 0, null: false
@@ -230,11 +230,12 @@ ActiveRecord::Schema.define(version: 20171015171559) do
230 t.string "last_sign_in_ip" 230 t.string "last_sign_in_ip"
231 t.datetime "created_at", null: false 231 t.datetime "created_at", null: false
232 t.datetime "updated_at", null: false 232 t.datetime "updated_at", null: false
233 t.string "pokeviewer_token", limit: 191 233 t.string "pokeviewer_token"
234 t.index ["email"], name: "index_users_on_email", unique: true 234 t.index ["email"], name: "index_users_on_email", unique: true
235 t.index ["login"], name: "index_users_on_login", unique: true 235 t.index ["login"], name: "index_users_on_login", unique: true
236 t.index ["pokeviewer_token"], name: "index_users_on_pokeviewer_token", unique: true 236 t.index ["pokeviewer_token"], name: "index_users_on_pokeviewer_token", unique: true
237 t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true 237 t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
238 end 238 end
239 239
240 add_foreign_key "pokeviewer_revisions", "pokeviewer_species", column: "species_id"
240end 241end