about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Gemfile3
-rw-r--r--Gemfile.lock171
-rw-r--r--app/controllers/application_controller.rb10
-rw-r--r--app/models/user.rb2
-rw-r--r--config/routes.rb2
-rw-r--r--db/migrate/20171015171142_add_pokeviewer_token_to_user.rb9
-rw-r--r--db/migrate/20171015171539_create_pokeviewer_trainers.pokeviewer.rb14
-rw-r--r--db/migrate/20171015171540_create_pokeviewer_species.pokeviewer.rb12
-rw-r--r--db/migrate/20171015171541_create_pokeviewer_pokemon.pokeviewer.rb32
-rw-r--r--db/migrate/20171015171542_create_pokeviewer_moves.pokeviewer.rb13
-rw-r--r--db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb52
-rw-r--r--db/migrate/20171015171544_make_met_level_nullable.pokeviewer.rb6
-rw-r--r--db/migrate/20171015171545_add_ot_gender_to_pokemon.pokeviewer.rb6
-rw-r--r--db/migrate/20171015171546_add_storage_info_to_pokemon.pokeviewer.rb7
-rw-r--r--db/migrate/20171015171547_create_pokeviewer_boxes.pokeviewer.rb16
-rw-r--r--db/migrate/20171015171548_create_pokeviewer_locations.pokeviewer.rb10
-rw-r--r--db/migrate/20171015171549_add_ribbons_to_revision.pokeviewer.rb25
-rw-r--r--db/migrate/20171015171550_create_pokeviewer_gift_ribbons.pokeviewer.rb10
-rw-r--r--db/migrate/20171015171551_add_gift_ribbons_to_trainer.pokeviewer.rb35
-rw-r--r--db/migrate/20171015171552_create_pokeviewer_items.pokeviewer.rb17
-rw-r--r--db/migrate/20171015171553_add_description_and_type_to_moves.pokeviewer.rb15
-rw-r--r--db/migrate/20171015171554_rename_revision_hold_item.pokeviewer.rb10
-rw-r--r--db/migrate/20171015171555_rename_pokemon_met_location.pokeviewer.rb31
-rw-r--r--db/migrate/20171015171556_remove_boxes.pokeviewer.rb107
-rw-r--r--db/migrate/20171015171557_add_pokeball_to_pokemon.pokeviewer.rb10
-rw-r--r--db/migrate/20171015171558_create_pokeviewer_abilities.pokeviewer.rb13
-rw-r--r--db/migrate/20171015171559_add_type_and_ability_to_species.pokeviewer.rb20
-rw-r--r--db/schema.rb177
-rw-r--r--db/seeds.rb1
29 files changed, 764 insertions, 72 deletions
diff --git a/Gemfile b/Gemfile index 869e0f5..aee427f 100644 --- a/Gemfile +++ b/Gemfile
@@ -7,7 +7,7 @@ end
7 7
8 8
9# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 9# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
10gem 'rails', '~> 5.1.1' 10gem 'rails', '~> 5.1.4'
11# Use sqlite3 as the database for Active Record 11# Use sqlite3 as the database for Active Record
12gem 'sqlite3' 12gem 'sqlite3'
13# Use Puma as the app server 13# Use Puma as the app server
@@ -68,3 +68,4 @@ gem 'devise'
68gem 'ckeditor' 68gem 'ckeditor'
69gem 'paperclip' 69gem 'paperclip'
70gem 'jquery-rails' 70gem 'jquery-rails'
71gem 'pokeviewer', github: "hatkirby/pokeviewer"
diff --git a/Gemfile.lock b/Gemfile.lock index 66508c8..be2a865 100644 --- a/Gemfile.lock +++ b/Gemfile.lock
@@ -1,76 +1,93 @@
1GIT
2 remote: https://github.com/hatkirby/pokeviewer.git
3 revision: b166b618d2f5e47d1755be55902a176555395de7
4 specs:
5 pokeviewer (0.1.0)
6 activerecord-diff
7 coffee-rails (~> 4.2)
8 enumerize
9 haml
10 jquery-rails
11 normalize-rails
12 rails (~> 5.1.4)
13 sass-rails (~> 5.0)
14 sequenced
15 victor
16
1GEM 17GEM
2 remote: https://rubygems.org/ 18 remote: https://rubygems.org/
3 specs: 19 specs:
4 actioncable (5.1.1) 20 actioncable (5.1.4)
5 actionpack (= 5.1.1) 21 actionpack (= 5.1.4)
6 nio4r (~> 2.0) 22 nio4r (~> 2.0)
7 websocket-driver (~> 0.6.1) 23 websocket-driver (~> 0.6.1)
8 actionmailer (5.1.1) 24 actionmailer (5.1.4)
9 actionpack (= 5.1.1) 25 actionpack (= 5.1.4)
10 actionview (= 5.1.1) 26 actionview (= 5.1.4)
11 activejob (= 5.1.1) 27 activejob (= 5.1.4)
12 mail (~> 2.5, >= 2.5.4) 28 mail (~> 2.5, >= 2.5.4)
13 rails-dom-testing (~> 2.0) 29 rails-dom-testing (~> 2.0)
14 actionpack (5.1.1) 30 actionpack (5.1.4)
15 actionview (= 5.1.1) 31 actionview (= 5.1.4)
16 activesupport (= 5.1.1) 32 activesupport (= 5.1.4)
17 rack (~> 2.0) 33 rack (~> 2.0)
18 rack-test (~> 0.6.3) 34 rack-test (>= 0.6.3)
19 rails-dom-testing (~> 2.0) 35 rails-dom-testing (~> 2.0)
20 rails-html-sanitizer (~> 1.0, >= 1.0.2) 36 rails-html-sanitizer (~> 1.0, >= 1.0.2)
21 actionview (5.1.1) 37 actionview (5.1.4)
22 activesupport (= 5.1.1) 38 activesupport (= 5.1.4)
23 builder (~> 3.1) 39 builder (~> 3.1)
24 erubi (~> 1.4) 40 erubi (~> 1.4)
25 rails-dom-testing (~> 2.0) 41 rails-dom-testing (~> 2.0)
26 rails-html-sanitizer (~> 1.0, >= 1.0.3) 42 rails-html-sanitizer (~> 1.0, >= 1.0.3)
27 activejob (5.1.1) 43 activejob (5.1.4)
28 activesupport (= 5.1.1) 44 activesupport (= 5.1.4)
29 globalid (>= 0.3.6) 45 globalid (>= 0.3.6)
30 activemodel (5.1.1) 46 activemodel (5.1.4)
31 activesupport (= 5.1.1) 47 activesupport (= 5.1.4)
32 activerecord (5.1.1) 48 activerecord (5.1.4)
33 activemodel (= 5.1.1) 49 activemodel (= 5.1.4)
34 activesupport (= 5.1.1) 50 activesupport (= 5.1.4)
35 arel (~> 8.0) 51 arel (~> 8.0)
36 activesupport (5.1.1) 52 activerecord-diff (2.0.0)
53 activesupport (5.1.4)
37 concurrent-ruby (~> 1.0, >= 1.0.2) 54 concurrent-ruby (~> 1.0, >= 1.0.2)
38 i18n (~> 0.7) 55 i18n (~> 0.7)
39 minitest (~> 5.1) 56 minitest (~> 5.1)
40 tzinfo (~> 1.1) 57 tzinfo (~> 1.1)
41 addressable (2.5.1) 58 addressable (2.5.2)
42 public_suffix (~> 2.0, >= 2.0.2) 59 public_suffix (>= 2.0.2, < 4.0)
43 airbrussh (1.2.0) 60 airbrussh (1.3.0)
44 sshkit (>= 1.6.1, != 1.7.0) 61 sshkit (>= 1.6.1, != 1.7.0)
45 arel (8.0.0) 62 arel (8.0.0)
46 bcrypt (3.1.11) 63 bcrypt (3.1.11)
47 bindex (0.5.0) 64 bindex (0.5.0)
48 builder (3.2.3) 65 builder (3.2.3)
49 byebug (9.0.6) 66 byebug (9.1.0)
50 capistrano (3.8.1) 67 capistrano (3.9.1)
51 airbrussh (>= 1.0.0) 68 airbrussh (>= 1.0.0)
52 i18n 69 i18n
53 rake (>= 10.0.0) 70 rake (>= 10.0.0)
54 sshkit (>= 1.9.0) 71 sshkit (>= 1.9.0)
55 capistrano-bundler (1.2.0) 72 capistrano-bundler (1.3.0)
56 capistrano (~> 3.1) 73 capistrano (~> 3.1)
57 sshkit (~> 1.2) 74 sshkit (~> 1.2)
58 capistrano-passenger (0.2.0) 75 capistrano-passenger (0.2.0)
59 capistrano (~> 3.0) 76 capistrano (~> 3.0)
60 capistrano-rails (1.2.3) 77 capistrano-rails (1.3.0)
61 capistrano (~> 3.1) 78 capistrano (~> 3.1)
62 capistrano-bundler (~> 1.1) 79 capistrano-bundler (~> 1.1)
63 capistrano-rvm (0.1.2) 80 capistrano-rvm (0.1.2)
64 capistrano (~> 3.0) 81 capistrano (~> 3.0)
65 sshkit (~> 1.2) 82 sshkit (~> 1.2)
66 capybara (2.14.3) 83 capybara (2.15.4)
67 addressable 84 addressable
68 mime-types (>= 1.16) 85 mini_mime (>= 0.1.3)
69 nokogiri (>= 1.3.3) 86 nokogiri (>= 1.3.3)
70 rack (>= 1.0.0) 87 rack (>= 1.0.0)
71 rack-test (>= 0.5.4) 88 rack-test (>= 0.5.4)
72 xpath (~> 2.0) 89 xpath (~> 2.0)
73 childprocess (0.7.0) 90 childprocess (0.8.0)
74 ffi (~> 1.0, >= 1.0.11) 91 ffi (~> 1.0, >= 1.0.11)
75 ckeditor (4.2.4) 92 ckeditor (4.2.4)
76 cocaine 93 cocaine
@@ -86,22 +103,25 @@ GEM
86 execjs 103 execjs
87 coffee-script-source (1.12.2) 104 coffee-script-source (1.12.2)
88 concurrent-ruby (1.0.5) 105 concurrent-ruby (1.0.5)
106 crass (1.0.2)
89 devise (4.3.0) 107 devise (4.3.0)
90 bcrypt (~> 3.0) 108 bcrypt (~> 3.0)
91 orm_adapter (~> 0.1) 109 orm_adapter (~> 0.1)
92 railties (>= 4.1.0, < 5.2) 110 railties (>= 4.1.0, < 5.2)
93 responders 111 responders
94 warden (~> 1.2.3) 112 warden (~> 1.2.3)
95 erubi (1.6.0) 113 enumerize (2.1.2)
114 activesupport (>= 3.2)
115 erubi (1.7.0)
96 execjs (2.7.0) 116 execjs (2.7.0)
97 ffi (1.9.18) 117 ffi (1.9.18)
98 globalid (0.4.0) 118 globalid (0.4.0)
99 activesupport (>= 4.2.0) 119 activesupport (>= 4.2.0)
100 haml (5.0.1) 120 haml (5.0.4)
101 temple (>= 0.8.0) 121 temple (>= 0.8.0)
102 tilt 122 tilt
103 highline (1.7.8) 123 highline (1.7.8)
104 i18n (0.8.4) 124 i18n (0.8.6)
105 jbuilder (2.7.0) 125 jbuilder (2.7.0)
106 activesupport (>= 4.2.0) 126 activesupport (>= 4.2.0)
107 multi_json (>= 1.2) 127 multi_json (>= 1.2)
@@ -109,30 +129,32 @@ GEM
109 rails-dom-testing (>= 1, < 3) 129 rails-dom-testing (>= 1, < 3)
110 railties (>= 4.2.0) 130 railties (>= 4.2.0)
111 thor (>= 0.14, < 2.0) 131 thor (>= 0.14, < 2.0)
112 libv8 (3.16.14.19-x86_64-darwin-16) 132 libv8 (3.16.14.19)
113 listen (3.1.5) 133 listen (3.1.5)
114 rb-fsevent (~> 0.9, >= 0.9.4) 134 rb-fsevent (~> 0.9, >= 0.9.4)
115 rb-inotify (~> 0.9, >= 0.9.7) 135 rb-inotify (~> 0.9, >= 0.9.7)
116 ruby_dep (~> 1.2) 136 ruby_dep (~> 1.2)
117 loofah (2.0.3) 137 loofah (2.1.1)
138 crass (~> 1.0.2)
118 nokogiri (>= 1.5.9) 139 nokogiri (>= 1.5.9)
119 mail (2.6.6) 140 mail (2.6.6)
120 mime-types (>= 1.16, < 4) 141 mime-types (>= 1.16, < 4)
121 method_source (0.8.2) 142 method_source (0.9.0)
122 mime-types (3.1) 143 mime-types (3.1)
123 mime-types-data (~> 3.2015) 144 mime-types-data (~> 3.2015)
124 mime-types-data (3.2016.0521) 145 mime-types-data (3.2016.0521)
125 mimemagic (0.3.2) 146 mimemagic (0.3.2)
126 mini_portile2 (2.2.0) 147 mini_mime (0.1.4)
127 minitest (5.10.2) 148 mini_portile2 (2.3.0)
128 multi_json (1.12.1) 149 minitest (5.10.3)
129 mysql2 (0.4.6) 150 multi_json (1.12.2)
151 mysql2 (0.4.9)
130 net-scp (1.2.1) 152 net-scp (1.2.1)
131 net-ssh (>= 2.6.5) 153 net-ssh (>= 2.6.5)
132 net-ssh (4.1.0) 154 net-ssh (4.2.0)
133 nio4r (2.1.0) 155 nio4r (2.1.0)
134 nokogiri (1.8.0) 156 nokogiri (1.8.1)
135 mini_portile2 (~> 2.2.0) 157 mini_portile2 (~> 2.3.0)
136 normalize-rails (4.1.1) 158 normalize-rails (4.1.1)
137 orm_adapter (0.5.0) 159 orm_adapter (0.5.0)
138 paperclip (5.1.0) 160 paperclip (5.1.0)
@@ -141,36 +163,36 @@ GEM
141 cocaine (~> 0.5.5) 163 cocaine (~> 0.5.5)
142 mime-types 164 mime-types
143 mimemagic (~> 0.3.0) 165 mimemagic (~> 0.3.0)
144 public_suffix (2.0.5) 166 public_suffix (3.0.0)
145 puma (3.9.1) 167 puma (3.10.0)
146 rack (2.0.3) 168 rack (2.0.3)
147 rack-test (0.6.3) 169 rack-test (0.7.0)
148 rack (>= 1.0) 170 rack (>= 1.0, < 3)
149 rails (5.1.1) 171 rails (5.1.4)
150 actioncable (= 5.1.1) 172 actioncable (= 5.1.4)
151 actionmailer (= 5.1.1) 173 actionmailer (= 5.1.4)
152 actionpack (= 5.1.1) 174 actionpack (= 5.1.4)
153 actionview (= 5.1.1) 175 actionview (= 5.1.4)
154 activejob (= 5.1.1) 176 activejob (= 5.1.4)
155 activemodel (= 5.1.1) 177 activemodel (= 5.1.4)
156 activerecord (= 5.1.1) 178 activerecord (= 5.1.4)
157 activesupport (= 5.1.1) 179 activesupport (= 5.1.4)
158 bundler (>= 1.3.0, < 2.0) 180 bundler (>= 1.3.0)
159 railties (= 5.1.1) 181 railties (= 5.1.4)
160 sprockets-rails (>= 2.0.0) 182 sprockets-rails (>= 2.0.0)
161 rails-dom-testing (2.0.3) 183 rails-dom-testing (2.0.3)
162 activesupport (>= 4.2.0) 184 activesupport (>= 4.2.0)
163 nokogiri (>= 1.6) 185 nokogiri (>= 1.6)
164 rails-html-sanitizer (1.0.3) 186 rails-html-sanitizer (1.0.3)
165 loofah (~> 2.0) 187 loofah (~> 2.0)
166 railties (5.1.1) 188 railties (5.1.4)
167 actionpack (= 5.1.1) 189 actionpack (= 5.1.4)
168 activesupport (= 5.1.1) 190 activesupport (= 5.1.4)
169 method_source 191 method_source
170 rake (>= 0.8.7) 192 rake (>= 0.8.7)
171 thor (>= 0.18.1, < 2.0) 193 thor (>= 0.18.1, < 2.0)
172 rake (12.0.0) 194 rake (12.1.0)
173 rb-fsevent (0.9.8) 195 rb-fsevent (0.10.2)
174 rb-inotify (0.9.10) 196 rb-inotify (0.9.10)
175 ffi (>= 0.5.0, < 2) 197 ffi (>= 0.5.0, < 2)
176 ref (2.0.0) 198 ref (2.0.0)
@@ -179,16 +201,23 @@ GEM
179 railties (>= 4.2.0, < 5.3) 201 railties (>= 4.2.0, < 5.3)
180 ruby_dep (1.5.0) 202 ruby_dep (1.5.0)
181 rubyzip (1.2.1) 203 rubyzip (1.2.1)
182 sass (3.4.24) 204 sass (3.5.2)
205 sass-listen (~> 4.0.0)
206 sass-listen (4.0.0)
207 rb-fsevent (~> 0.9, >= 0.9.4)
208 rb-inotify (~> 0.9, >= 0.9.7)
183 sass-rails (5.0.6) 209 sass-rails (5.0.6)
184 railties (>= 4.0.0, < 6) 210 railties (>= 4.0.0, < 6)
185 sass (~> 3.1) 211 sass (~> 3.1)
186 sprockets (>= 2.8, < 4.0) 212 sprockets (>= 2.8, < 4.0)
187 sprockets-rails (>= 2.0, < 4.0) 213 sprockets-rails (>= 2.0, < 4.0)
188 tilt (>= 1.1, < 3) 214 tilt (>= 1.1, < 3)
189 selenium-webdriver (3.4.3) 215 selenium-webdriver (3.6.0)
190 childprocess (~> 0.5) 216 childprocess (~> 0.5)
191 rubyzip (~> 1.0) 217 rubyzip (~> 1.0)
218 sequenced (3.1.1)
219 activerecord (>= 3.0)
220 activesupport (>= 3.0)
192 spring (2.0.2) 221 spring (2.0.2)
193 activesupport (>= 4.2) 222 activesupport (>= 4.2)
194 spring-watcher-listen (2.0.1) 223 spring-watcher-listen (2.0.1)
@@ -197,21 +226,21 @@ GEM
197 sprockets (3.7.1) 226 sprockets (3.7.1)
198 concurrent-ruby (~> 1.0) 227 concurrent-ruby (~> 1.0)
199 rack (> 1, < 3) 228 rack (> 1, < 3)
200 sprockets-rails (3.2.0) 229 sprockets-rails (3.2.1)
201 actionpack (>= 4.0) 230 actionpack (>= 4.0)
202 activesupport (>= 4.0) 231 activesupport (>= 4.0)
203 sprockets (>= 3.0.0) 232 sprockets (>= 3.0.0)
204 sqlite3 (1.3.13) 233 sqlite3 (1.3.13)
205 sshkit (1.13.1) 234 sshkit (1.14.0)
206 net-scp (>= 1.1.2) 235 net-scp (>= 1.1.2)
207 net-ssh (>= 2.8.0) 236 net-ssh (>= 2.8.0)
208 temple (0.8.0) 237 temple (0.8.0)
209 therubyracer (0.12.3) 238 therubyracer (0.12.3)
210 libv8 (~> 3.16.14.15) 239 libv8 (~> 3.16.14.15)
211 ref 240 ref
212 thor (0.19.4) 241 thor (0.20.0)
213 thread_safe (0.3.6) 242 thread_safe (0.3.6)
214 tilt (2.0.7) 243 tilt (2.0.8)
215 turbolinks (5.0.1) 244 turbolinks (5.0.1)
216 turbolinks-source (~> 5) 245 turbolinks-source (~> 5)
217 turbolinks-source (5.0.3) 246 turbolinks-source (5.0.3)
@@ -219,6 +248,7 @@ GEM
219 thread_safe (~> 0.1) 248 thread_safe (~> 0.1)
220 uglifier (3.2.0) 249 uglifier (3.2.0)
221 execjs (>= 0.3.0, < 3) 250 execjs (>= 0.3.0, < 3)
251 victor (0.2.1)
222 warden (1.2.7) 252 warden (1.2.7)
223 rack (>= 1.0) 253 rack (>= 1.0)
224 web-console (3.5.1) 254 web-console (3.5.1)
@@ -254,8 +284,9 @@ DEPENDENCIES
254 mysql2 284 mysql2
255 normalize-rails 285 normalize-rails
256 paperclip 286 paperclip
287 pokeviewer!
257 puma (~> 3.7) 288 puma (~> 3.7)
258 rails (~> 5.1.1) 289 rails (~> 5.1.4)
259 sass-rails (~> 5.0) 290 sass-rails (~> 5.0)
260 selenium-webdriver 291 selenium-webdriver
261 spring 292 spring
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0174cae..c9d4e15 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb
@@ -1,6 +1,16 @@
1class ApplicationController < ActionController::Base 1class ApplicationController < ActionController::Base
2 protect_from_forgery with: :exception 2 protect_from_forgery with: :exception
3 3
4 protected
5
6 def authenticate_pokeviewer(login, token)
7 user = login && User.find_by_login(login)
8
9 ActiveSupport::SecurityUtils.secure_compare(
10 ::Digest::SHA256.hexdigest(user.pokeviewer_token),
11 ::Digest::SHA256.hexdigest(token))
12 end
13
4 private 14 private
5 15
6 def after_sign_out_path_for(resource) 16 def after_sign_out_path_for(resource)
diff --git a/app/models/user.rb b/app/models/user.rb index b8bdae1..555729a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb
@@ -3,4 +3,6 @@ class User < ApplicationRecord
3 # :confirmable, :lockable, :timeoutable and :omniauthable 3 # :confirmable, :lockable, :timeoutable and :omniauthable
4 devise :database_authenticatable, 4 devise :database_authenticatable,
5 :recoverable, :rememberable, :trackable, :validatable 5 :recoverable, :rememberable, :trackable, :validatable
6
7 has_secure_token :pokeviewer_token
6end 8end
diff --git a/config/routes.rb b/config/routes.rb index 1003a8b..1216b85 100644 --- a/config/routes.rb +++ b/config/routes.rb
@@ -15,4 +15,6 @@ Rails.application.routes.draw do
15 root "records#index" 15 root "records#index"
16 16
17 get 'says/:slug', to: 'entries#show' 17 get 'says/:slug', to: 'entries#show'
18
19 mount Pokeviewer::Engine => '/poke3'
18end 20end
diff --git a/db/migrate/20171015171142_add_pokeviewer_token_to_user.rb b/db/migrate/20171015171142_add_pokeviewer_token_to_user.rb new file mode 100644 index 0000000..2dc5143 --- /dev/null +++ b/db/migrate/20171015171142_add_pokeviewer_token_to_user.rb
@@ -0,0 +1,9 @@
1class AddPokeviewerTokenToUser < ActiveRecord::Migration[5.1]
2 def change
3 change_table :users do |t|
4 t.string :pokeviewer_token, limit: 191
5 end
6
7 add_index :users, :pokeviewer_token, unique: true
8 end
9end
diff --git a/db/migrate/20171015171539_create_pokeviewer_trainers.pokeviewer.rb b/db/migrate/20171015171539_create_pokeviewer_trainers.pokeviewer.rb new file mode 100644 index 0000000..396bcea --- /dev/null +++ b/db/migrate/20171015171539_create_pokeviewer_trainers.pokeviewer.rb
@@ -0,0 +1,14 @@
1# This migration comes from pokeviewer (originally 20170916225306)
2class CreatePokeviewerTrainers < ActiveRecord::Migration[5.1]
3 def change
4 create_table :pokeviewer_trainers do |t|
5 t.string :game, null: false
6 t.string :name, null: false, limit: 191
7 t.integer :number, null: false
8
9 t.timestamps
10 end
11
12 add_index :pokeviewer_trainers, [:name, :number], unique: true
13 end
14end
diff --git a/db/migrate/20171015171540_create_pokeviewer_species.pokeviewer.rb b/db/migrate/20171015171540_create_pokeviewer_species.pokeviewer.rb new file mode 100644 index 0000000..d3e299f --- /dev/null +++ b/db/migrate/20171015171540_create_pokeviewer_species.pokeviewer.rb
@@ -0,0 +1,12 @@
1# This migration comes from pokeviewer (originally 20170916232015)
2class CreatePokeviewerSpecies < ActiveRecord::Migration[5.1]
3 def change
4 create_table :pokeviewer_species do |t|
5 t.string :name, null: false, limit: 191
6
7 t.timestamps
8 end
9
10 add_index :pokeviewer_species, :name, unique: true
11 end
12end
diff --git a/db/migrate/20171015171541_create_pokeviewer_pokemon.pokeviewer.rb b/db/migrate/20171015171541_create_pokeviewer_pokemon.pokeviewer.rb new file mode 100644 index 0000000..dd14d8c --- /dev/null +++ b/db/migrate/20171015171541_create_pokeviewer_pokemon.pokeviewer.rb
@@ -0,0 +1,32 @@
1# This migration comes from pokeviewer (originally 20170916234251)
2class CreatePokeviewerPokemon < ActiveRecord::Migration[5.1]
3 def change
4 create_table :pokeviewer_pokemon do |t|
5 t.string :uuid, null: false, limit: 191
6 t.references :species, null: false
7 t.references :trainer, null: true
8 t.string :key, null: true, limit: 191
9 t.string :ot_name, null: false
10 t.integer :ot_number, null: false
11 t.string :met_type, null: false
12 t.string :met_location, null: true
13 t.integer :met_level, null: false
14 t.boolean :shiny, null: false, default: false
15 t.string :nature, null: false
16 t.string :gender, null: false
17 t.boolean :second_ability, null: false
18 t.string :unown_letter, null: true, limit: 1
19
20 t.timestamps
21 end
22
23 add_index :pokeviewer_pokemon, :uuid, unique: true
24 add_index :pokeviewer_pokemon, :key, unique: true
25
26 add_foreign_key :pokeviewer_pokemon, :pokeviewer_species,
27 column: :species_id
28
29 add_foreign_key :pokeviewer_pokemon, :pokeviewer_trainers,
30 column: :trainer_id
31 end
32end
diff --git a/db/migrate/20171015171542_create_pokeviewer_moves.pokeviewer.rb b/db/migrate/20171015171542_create_pokeviewer_moves.pokeviewer.rb new file mode 100644 index 0000000..47fa68f --- /dev/null +++ b/db/migrate/20171015171542_create_pokeviewer_moves.pokeviewer.rb
@@ -0,0 +1,13 @@
1# This migration comes from pokeviewer (originally 20170917011102)
2class CreatePokeviewerMoves < ActiveRecord::Migration[5.1]
3 def change
4 create_table :pokeviewer_moves do |t|
5 t.string :name, null: false, limit: 191
6 t.integer :pp, null: false
7
8 t.timestamps
9 end
10
11 add_index :pokeviewer_moves, :name, unique: true
12 end
13end
diff --git a/db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb b/db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb new file mode 100644 index 0000000..c44c227 --- /dev/null +++ b/db/migrate/20171015171543_create_pokeviewer_revisions.pokeviewer.rb
@@ -0,0 +1,52 @@
1# This migration comes from pokeviewer (originally 20170917011258)
2class CreatePokeviewerRevisions < ActiveRecord::Migration[5.1]
3 def change
4 create_table :pokeviewer_revisions do |t|
5 t.references :pokemon, null: false
6 t.integer :sequential_id, null: false
7 t.string :nickname, null: false
8 t.integer :experience, null: false
9 t.integer :level, null: false
10 t.integer :hp, null: false
11 t.integer :attack, null: false
12 t.integer :defense, null: false
13 t.integer :special_attack, null: false
14 t.integer :special_defense, null: false
15 t.integer :speed, null: false
16 t.integer :coolness, null: false
17 t.integer :beauty, null: false
18 t.integer :cuteness, null: false
19 t.integer :smartness, null: false
20 t.integer :toughness, null: false
21 t.integer :sheen, null: false
22 t.integer :hold_item, null: true
23 t.references :move_1, null: false
24 t.references :move_2, null: true
25 t.references :move_3, null: true
26 t.references :move_4, null: true
27 t.integer :move_1_pp_bonuses, null: false, default: 0
28 t.integer :move_2_pp_bonuses, null: false, default: 0
29 t.integer :move_3_pp_bonuses, null: false, default: 0
30 t.integer :move_4_pp_bonuses, null: false, default: 0
31
32 t.timestamps
33 end
34
35 add_index :pokeviewer_revisions, [:pokemon_id, :sequential_id], unique: true
36
37 add_foreign_key :pokeviewer_revisions, :pokewalker_pokemon,
38 column: :pokemon_id
39
40 add_foreign_key :pokeviewer_revisions, :pokewalker_moves,
41 column: :move_1_id
42
43 add_foreign_key :pokeviewer_revisions, :pokewalker_moves,
44 column: :move_2_id
45
46 add_foreign_key :pokeviewer_revisions, :pokewalker_moves,
47 column: :move_3_id
48
49 add_foreign_key :pokeviewer_revisions, :pokewalker_moves,
50 column: :move_4_id
51 end
52end
diff --git a/db/migrate/20171015171544_make_met_level_nullable.pokeviewer.rb b/db/migrate/20171015171544_make_met_level_nullable.pokeviewer.rb new file mode 100644 index 0000000..058a591 --- /dev/null +++ b/db/migrate/20171015171544_make_met_level_nullable.pokeviewer.rb
@@ -0,0 +1,6 @@
1# This migration comes from pokeviewer (originally 20170924035127)
2class MakeMetLevelNullable < ActiveRecord::Migration[5.1]
3 def change
4 change_column :pokeviewer_pokemon, :met_level, :integer, null: true
5 end
6end
diff --git a/db/migrate/20171015171545_add_ot_gender_to_pokemon.pokeviewer.rb b/db/migrate/20171015171545_add_ot_gender_to_pokemon.pokeviewer.rb new file mode 100644 index 0000000..8ad7f77 --- /dev/null +++ b/db/migrate/20171015171545_add_ot_gender_to_pokemon.pokeviewer.rb
@@ -0,0 +1,6 @@
1# This migration comes from pokeviewer (originally 20170924152817)
2class AddOtGenderToPokemon < ActiveRecord::Migration[5.1]
3 def change
4 add_column :pokeviewer_pokemon, :ot_gender, :string, null: false, default: ""
5 end
6end
diff --git a/db/migrate/20171015171546_add_storage_info_to_pokemon.pokeviewer.rb b/db/migrate/20171015171546_add_storage_info_to_pokemon.pokeviewer.rb new file mode 100644 index 0000000..794dd13 --- /dev/null +++ b/db/migrate/20171015171546_add_storage_info_to_pokemon.pokeviewer.rb
@@ -0,0 +1,7 @@
1# This migration comes from pokeviewer (originally 20170924160524)
2class AddStorageInfoToPokemon < ActiveRecord::Migration[5.1]
3 def change
4 add_column :pokeviewer_pokemon, :box, :integer, null: true
5 add_column :pokeviewer_pokemon, :slot, :integer, null: true
6 end
7end
diff --git a/db/migrate/20171015171547_create_pokeviewer_boxes.pokeviewer.rb b/db/migrate/20171015171547_create_pokeviewer_boxes.pokeviewer.rb new file mode 100644 index 0000000..90323d1 --- /dev/null +++ b/db/migrate/20171015171547_create_pokeviewer_boxes.pokeviewer.rb
@@ -0,0 +1,16 @@
1# This migration comes from pokeviewer (originally 20170924224550)
2class CreatePokeviewerBoxes < ActiveRecord::Migration[5.1]
3 def change
4 create_table :pokeviewer_boxes do |t|
5 t.references :trainer, null: false
6 t.integer :number, null: false
7 t.string :name, null: false
8
9 t.timestamps
10 end
11
12 add_foreign_key :pokeviewer_boxes, :pokeviewer_trainers, column: :trainer_id
13
14 add_index :pokeviewer_boxes, [:trainer_id, :number], unique: true
15 end
16end
diff --git a/db/migrate/20171015171548_create_pokeviewer_locations.pokeviewer.rb b/db/migrate/20171015171548_create_pokeviewer_locations.pokeviewer.rb new file mode 100644 index 0000000..c5589b0 --- /dev/null +++ b/db/migrate/20171015171548_create_pokeviewer_locations.pokeviewer.rb
@@ -0,0 +1,10 @@
1# This migration comes from pokeviewer (originally 20170925013807)
2class CreatePokeviewerLocations < ActiveRecord::Migration[5.1]
3 def change
4 create_table :pokeviewer_locations do |t|
5 t.string :name, null: false
6
7 t.timestamps
8 end
9 end
10end
diff --git a/db/migrate/20171015171549_add_ribbons_to_revision.pokeviewer.rb b/db/migrate/20171015171549_add_ribbons_to_revision.pokeviewer.rb new file mode 100644 index 0000000..01f4c2d --- /dev/null +++ b/db/migrate/20171015171549_add_ribbons_to_revision.pokeviewer.rb
@@ -0,0 +1,25 @@
1# This migration comes from pokeviewer (originally 20170929211529)
2class AddRibbonsToRevision < ActiveRecord::Migration[5.1]
3 def change
4 change_table :pokeviewer_revisions do |t|
5 t.integer :cool_ribbons, null: false, default: 0
6 t.integer :beauty_ribbons, null: false, default: 0
7 t.integer :cute_ribbons, null: false, default: 0
8 t.integer :smart_ribbons, null: false, default: 0
9 t.integer :tough_ribbons, null: false, default: 0
10
11 t.boolean :champion_ribbon, default: false
12 t.boolean :winning_ribbon, default: false
13 t.boolean :victory_ribbon, default: false
14 t.boolean :artist_ribbon, default: false
15 t.boolean :effort_ribbon, default: false
16 t.boolean :marine_ribbon, default: false
17 t.boolean :land_ribbon, default: false
18 t.boolean :sky_ribbon, default: false
19 t.boolean :country_ribbon, default: false
20 t.boolean :national_ribbon, default: false
21 t.boolean :earth_ribbon, default: false
22 t.boolean :world_ribbon, default: false
23 end
24 end
25end
diff --git a/db/migrate/20171015171550_create_pokeviewer_gift_ribbons.pokeviewer.rb b/db/migrate/20171015171550_create_pokeviewer_gift_ribbons.pokeviewer.rb new file mode 100644 index 0000000..5c055f4 --- /dev/null +++ b/db/migrate/20171015171550_create_pokeviewer_gift_ribbons.pokeviewer.rb
@@ -0,0 +1,10 @@
1# This migration comes from pokeviewer (originally 20170929221317)
2class CreatePokeviewerGiftRibbons < ActiveRecord::Migration[5.1]
3 def change
4 create_table :pokeviewer_gift_ribbons do |t|
5 t.string :description, null: false
6
7 t.timestamps
8 end
9 end
10end
diff --git a/db/migrate/20171015171551_add_gift_ribbons_to_trainer.pokeviewer.rb b/db/migrate/20171015171551_add_gift_ribbons_to_trainer.pokeviewer.rb new file mode 100644 index 0000000..5bef8d5 --- /dev/null +++ b/db/migrate/20171015171551_add_gift_ribbons_to_trainer.pokeviewer.rb
@@ -0,0 +1,35 @@
1# This migration comes from pokeviewer (originally 20170930021856)
2class AddGiftRibbonsToTrainer < ActiveRecord::Migration[5.1]
3 def change
4 change_table :pokeviewer_trainers do |t|
5 t.references :marine_ribbon, null: true
6 t.references :land_ribbon, null: true
7 t.references :sky_ribbon, null: true
8 t.references :country_ribbon, null: true
9 t.references :national_ribbon, null: true
10 t.references :earth_ribbon, null: true
11 t.references :world_ribbon, null: true
12 end
13
14 add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
15 column: :marine_ribbon_id
16
17 add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
18 column: :land_ribbon_id
19
20 add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
21 column: :sky_ribbon_id
22
23 add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
24 column: :country_ribbon_id
25
26 add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
27 column: :national_ribbon_id
28
29 add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
30 column: :earth_ribbon_id
31
32 add_foreign_key :pokeviewer_trainers, :pokeviewer_gift_ribbons,
33 column: :world_ribbon_id
34 end
35end
diff --git a/db/migrate/20171015171552_create_pokeviewer_items.pokeviewer.rb b/db/migrate/20171015171552_create_pokeviewer_items.pokeviewer.rb new file mode 100644 index 0000000..7adc387 --- /dev/null +++ b/db/migrate/20171015171552_create_pokeviewer_items.pokeviewer.rb
@@ -0,0 +1,17 @@
1# This migration comes from pokeviewer (originally 20170930185514)
2class CreatePokeviewerItems < ActiveRecord::Migration[5.1]
3 def change
4 create_table :pokeviewer_items do |t|
5 t.string :name, null: false
6 t.boolean :tm, null: false, default: false
7 t.references :move, null: true
8 t.string :rs_description
9 t.string :frlg_description
10 t.string :emerald_description
11
12 t.timestamps
13 end
14
15 add_foreign_key :pokeviewer_items, :pokeviewer_moves, column: :move_id
16 end
17end
diff --git a/db/migrate/20171015171553_add_description_and_type_to_moves.pokeviewer.rb b/db/migrate/20171015171553_add_description_and_type_to_moves.pokeviewer.rb new file mode 100644 index 0000000..0eb7cb1 --- /dev/null +++ b/db/migrate/20171015171553_add_description_and_type_to_moves.pokeviewer.rb
@@ -0,0 +1,15 @@
1# This migration comes from pokeviewer (originally 20170930190647)
2class AddDescriptionAndTypeToMoves < ActiveRecord::Migration[5.1]
3 def change
4 change_table :pokeviewer_moves do |t|
5 t.string :move_type, null: false, default: ""
6 t.string :rs_description, null: false, default: ""
7 t.string :frlg_description, null: false, default: ""
8 t.string :emerald_description
9 end
10
11 change_column_default :pokeviewer_moves, :move_type, nil
12 change_column_default :pokeviewer_moves, :rs_description, nil
13 change_column_default :pokeviewer_moves, :frlg_description, nil
14 end
15end
diff --git a/db/migrate/20171015171554_rename_revision_hold_item.pokeviewer.rb b/db/migrate/20171015171554_rename_revision_hold_item.pokeviewer.rb new file mode 100644 index 0000000..f7246de --- /dev/null +++ b/db/migrate/20171015171554_rename_revision_hold_item.pokeviewer.rb
@@ -0,0 +1,10 @@
1# This migration comes from pokeviewer (originally 20170930213633)
2class RenameRevisionHoldItem < ActiveRecord::Migration[5.1]
3 def change
4 change_table :pokeviewer_revisions do |t|
5 t.rename :hold_item, :item_id
6 end
7
8 add_foreign_key :pokeviewer_revisions, :pokeviewer_items, column: :item_id
9 end
10end
diff --git a/db/migrate/20171015171555_rename_pokemon_met_location.pokeviewer.rb b/db/migrate/20171015171555_rename_pokemon_met_location.pokeviewer.rb new file mode 100644 index 0000000..afb5987 --- /dev/null +++ b/db/migrate/20171015171555_rename_pokemon_met_location.pokeviewer.rb
@@ -0,0 +1,31 @@
1# This migration comes from pokeviewer (originally 20171003154157)
2class RenamePokemonMetLocation < ActiveRecord::Migration[5.1]
3 def up
4 add_column :pokeviewer_pokemon, :location_id, :integer, null: true
5
6 add_foreign_key :pokeviewer_pokemon, :pokeviewer_locations,
7 column: :location_id
8
9 Pokeviewer::Pokemon.all.each do |p|
10 unless p.met_location.nil?
11 p.location_id = p.met_location.to_i
12 p.save!
13 end
14 end
15
16 remove_column :pokeviewer_pokemon, :met_location
17 end
18
19 def down
20 add_column :pokeviewer_pokemon, :met_location, :string
21
22 Pokeviewer::Pokemon.all.each do |p|
23 unless p.location_id.nil?
24 p.met_location = p.location_id.to_s
25 p.save!
26 end
27 end
28
29 remove_column :pokeviewer_pokemon, :location_id
30 end
31end
diff --git a/db/migrate/20171015171556_remove_boxes.pokeviewer.rb b/db/migrate/20171015171556_remove_boxes.pokeviewer.rb new file mode 100644 index 0000000..c3cbbb1 --- /dev/null +++ b/db/migrate/20171015171556_remove_boxes.pokeviewer.rb
@@ -0,0 +1,107 @@
1# This migration comes from pokeviewer (originally 20171003191205)
2class RemoveBoxes < ActiveRecord::Migration[5.1]
3 def up
4 change_table :pokeviewer_trainers do |t|
5 t.string :box_1_name, null: false, default: ""
6 t.string :box_2_name, null: false, default: ""
7 t.string :box_3_name, null: false, default: ""
8 t.string :box_4_name, null: false, default: ""
9 t.string :box_5_name, null: false, default: ""
10 t.string :box_6_name, null: false, default: ""
11 t.string :box_7_name, null: false, default: ""
12 t.string :box_8_name, null: false, default: ""
13 t.string :box_9_name, null: false, default: ""
14 t.string :box_10_name, null: false, default: ""
15 t.string :box_11_name, null: false, default: ""
16 t.string :box_12_name, null: false, default: ""
17 t.string :box_13_name, null: false, default: ""
18 t.string :box_14_name, null: false, default: ""
19 end
20
21 change_column_default :pokeviewer_trainers, :box_1_name, nil
22 change_column_default :pokeviewer_trainers, :box_2_name, nil
23 change_column_default :pokeviewer_trainers, :box_3_name, nil
24 change_column_default :pokeviewer_trainers, :box_4_name, nil
25 change_column_default :pokeviewer_trainers, :box_5_name, nil
26 change_column_default :pokeviewer_trainers, :box_6_name, nil
27 change_column_default :pokeviewer_trainers, :box_7_name, nil
28 change_column_default :pokeviewer_trainers, :box_8_name, nil
29 change_column_default :pokeviewer_trainers, :box_9_name, nil
30 change_column_default :pokeviewer_trainers, :box_10_name, nil
31 change_column_default :pokeviewer_trainers, :box_11_name, nil
32 change_column_default :pokeviewer_trainers, :box_12_name, nil
33 change_column_default :pokeviewer_trainers, :box_13_name, nil
34 change_column_default :pokeviewer_trainers, :box_14_name, nil
35
36 Pokeviewer::Trainer.all.each do |t|
37 boxes = ActiveRecord::Base.connection.select_all(
38 "SELECT * FROM pokeviewer_boxes WHERE trainer_id = ? ORDER BY number ASC",
39 t.trainer_id).map { |b| b["name"] }
40
41 t.box_1_name = boxes.shift
42 t.box_2_name = boxes.shift
43 t.box_3_name = boxes.shift
44 t.box_4_name = boxes.shift
45 t.box_5_name = boxes.shift
46 t.box_6_name = boxes.shift
47 t.box_7_name = boxes.shift
48 t.box_8_name = boxes.shift
49 t.box_9_name = boxes.shift
50 t.box_10_name = boxes.shift
51 t.box_11_name = boxes.shift
52 t.box_12_name = boxes.shift
53 t.box_13_name = boxes.shift
54 t.box_14_name = boxes.shift
55
56 t.save
57 end
58
59 drop_table :pokeviewer_boxes
60 end
61
62 def down
63 create_table :pokeviewer_boxes do |t|
64 t.integer "trainer_id", null: false
65 t.integer "number", null: false
66 t.string "name", null: false
67
68 t.timestamps
69 end
70
71 add_index :pokeviewer_boxes, [:trainer_id, :number], unique: true
72
73 add_foreign_key :pokeviewer_boxes, :pokeviewer_trainers, column: :trainer_id
74
75 Pokeviewer::Trainer.all.each do |t|
76 Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 1, name: t.box_1_name)
77 Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 2, name: t.box_2_name)
78 Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 3, name: t.box_3_name)
79 Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 4, name: t.box_4_name)
80 Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 5, name: t.box_5_name)
81 Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 6, name: t.box_6_name)
82 Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 7, name: t.box_7_name)
83 Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 8, name: t.box_8_name)
84 Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 9, name: t.box_9_name)
85 Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 10, name: t.box_10_name)
86 Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 11, name: t.box_11_name)
87 Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 12, name: t.box_12_name)
88 Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 13, name: t.box_13_name)
89 Pokeviewer::Box.create(trainer_id: t.trainer_id, number: 14, name: t.box_14_name)
90 end
91
92 remove_column :pokeviewer_trainers, :box_1_name
93 remove_column :pokeviewer_trainers, :box_2_name
94 remove_column :pokeviewer_trainers, :box_3_name
95 remove_column :pokeviewer_trainers, :box_4_name
96 remove_column :pokeviewer_trainers, :box_5_name
97 remove_column :pokeviewer_trainers, :box_6_name
98 remove_column :pokeviewer_trainers, :box_7_name
99 remove_column :pokeviewer_trainers, :box_8_name
100 remove_column :pokeviewer_trainers, :box_9_name
101 remove_column :pokeviewer_trainers, :box_10_name
102 remove_column :pokeviewer_trainers, :box_11_name
103 remove_column :pokeviewer_trainers, :box_12_name
104 remove_column :pokeviewer_trainers, :box_13_name
105 remove_column :pokeviewer_trainers, :box_14_name
106 end
107end
diff --git a/db/migrate/20171015171557_add_pokeball_to_pokemon.pokeviewer.rb b/db/migrate/20171015171557_add_pokeball_to_pokemon.pokeviewer.rb new file mode 100644 index 0000000..01f6f97 --- /dev/null +++ b/db/migrate/20171015171557_add_pokeball_to_pokemon.pokeviewer.rb
@@ -0,0 +1,10 @@
1# This migration comes from pokeviewer (originally 20171004203404)
2class AddPokeballToPokemon < ActiveRecord::Migration[5.1]
3 def change
4 change_table :pokeviewer_pokemon do |t|
5 t.string :pokeball, null: false, default: :poke
6 end
7
8 change_column_default :pokeviewer_pokemon, :pokeball, nil
9 end
10end
diff --git a/db/migrate/20171015171558_create_pokeviewer_abilities.pokeviewer.rb b/db/migrate/20171015171558_create_pokeviewer_abilities.pokeviewer.rb new file mode 100644 index 0000000..3120683 --- /dev/null +++ b/db/migrate/20171015171558_create_pokeviewer_abilities.pokeviewer.rb
@@ -0,0 +1,13 @@
1# This migration comes from pokeviewer (originally 20171011015325)
2class CreatePokeviewerAbilities < ActiveRecord::Migration[5.1]
3 def change
4 create_table :pokeviewer_abilities do |t|
5 t.string :name, null: false, limit: 191
6 t.string :description, null: false
7
8 t.timestamps
9 end
10
11 add_index :pokeviewer_abilities, :name, unique: true
12 end
13end
diff --git a/db/migrate/20171015171559_add_type_and_ability_to_species.pokeviewer.rb b/db/migrate/20171015171559_add_type_and_ability_to_species.pokeviewer.rb new file mode 100644 index 0000000..a7da236 --- /dev/null +++ b/db/migrate/20171015171559_add_type_and_ability_to_species.pokeviewer.rb
@@ -0,0 +1,20 @@
1# This migration comes from pokeviewer (originally 20171011015648)
2class AddTypeAndAbilityToSpecies < ActiveRecord::Migration[5.1]
3 def change
4 change_table :pokeviewer_species do |t|
5 t.string :type_1, null: false, default: ""
6 t.string :type_2
7 t.integer :ability_1_id, null: false, default: 0
8 t.integer :ability_2_id
9 end
10
11 change_column_default :pokeviewer_species, :type_1, nil
12 change_column_default :pokeviewer_species, :ability_1_id, nil
13
14 add_foreign_key :pokeviewer_species, :pokeviewer_abilities,
15 column: :ability_1_id
16
17 add_foreign_key :pokeviewer_species, :pokeviewer_abilities,
18 column: :ability_2_id
19 end
20end
diff --git a/db/schema.rb b/db/schema.rb index fc6614a..ede1db3 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
13ActiveRecord::Schema.define(version: 20170703013609) do 13ActiveRecord::Schema.define(version: 20171015171559) do
14 14
15 create_table "ckeditor_assets", force: :cascade do |t| 15 create_table "ckeditor_assets", force: :cascade do |t|
16 t.string "data_file_name", null: false 16 t.string "data_file_name", null: false
@@ -34,6 +34,179 @@ ActiveRecord::Schema.define(version: 20170703013609) 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|
38 t.string "name", limit: 191, null: false
39 t.string "description", null: false
40 t.datetime "created_at", null: false
41 t.datetime "updated_at", null: false
42 t.index ["name"], name: "index_pokeviewer_abilities_on_name", unique: true
43 end
44
45 create_table "pokeviewer_gift_ribbons", force: :cascade do |t|
46 t.string "description", null: false
47 t.datetime "created_at", null: false
48 t.datetime "updated_at", null: false
49 end
50
51 create_table "pokeviewer_items", force: :cascade do |t|
52 t.string "name", null: false
53 t.boolean "tm", default: false, null: false
54 t.integer "move_id"
55 t.string "rs_description"
56 t.string "frlg_description"
57 t.string "emerald_description"
58 t.datetime "created_at", null: false
59 t.datetime "updated_at", null: false
60 t.index ["move_id"], name: "index_pokeviewer_items_on_move_id"
61 end
62
63 create_table "pokeviewer_locations", force: :cascade do |t|
64 t.string "name", null: false
65 t.datetime "created_at", null: false
66 t.datetime "updated_at", null: false
67 end
68
69 create_table "pokeviewer_moves", force: :cascade do |t|
70 t.string "name", limit: 191, null: false
71 t.integer "pp", null: false
72 t.datetime "created_at", null: false
73 t.datetime "updated_at", null: false
74 t.string "move_type", null: false
75 t.string "rs_description", null: false
76 t.string "frlg_description", null: false
77 t.string "emerald_description"
78 t.index ["name"], name: "index_pokeviewer_moves_on_name", unique: true
79 end
80
81 create_table "pokeviewer_pokemon", force: :cascade do |t|
82 t.string "uuid", limit: 191, null: false
83 t.integer "species_id", null: false
84 t.integer "trainer_id"
85 t.string "key", limit: 191
86 t.string "ot_name", null: false
87 t.integer "ot_number", null: false
88 t.string "met_type", null: false
89 t.integer "met_level"
90 t.boolean "shiny", default: false, null: false
91 t.string "nature", null: false
92 t.string "gender", null: false
93 t.boolean "second_ability", null: false
94 t.string "unown_letter", limit: 1
95 t.datetime "created_at", null: false
96 t.datetime "updated_at", null: false
97 t.string "ot_gender", default: "", null: false
98 t.integer "box"
99 t.integer "slot"
100 t.integer "location_id"
101 t.string "pokeball", null: false
102 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"
105 t.index ["uuid"], name: "index_pokeviewer_pokemon_on_uuid", unique: true
106 end
107
108 create_table "pokeviewer_revisions", force: :cascade do |t|
109 t.integer "pokemon_id", null: false
110 t.integer "sequential_id", null: false
111 t.string "nickname", null: false
112 t.integer "experience", null: false
113 t.integer "level", null: false
114 t.integer "hp", null: false
115 t.integer "attack", null: false
116 t.integer "defense", null: false
117 t.integer "special_attack", null: false
118 t.integer "special_defense", null: false
119 t.integer "speed", null: false
120 t.integer "coolness", null: false
121 t.integer "beauty", null: false
122 t.integer "cuteness", null: false
123 t.integer "smartness", null: false
124 t.integer "toughness", null: false
125 t.integer "sheen", null: false
126 t.integer "item_id"
127 t.integer "move_1_id", null: false
128 t.integer "move_2_id"
129 t.integer "move_3_id"
130 t.integer "move_4_id"
131 t.integer "move_1_pp_bonuses", default: 0, null: false
132 t.integer "move_2_pp_bonuses", default: 0, null: false
133 t.integer "move_3_pp_bonuses", default: 0, null: false
134 t.integer "move_4_pp_bonuses", default: 0, null: false
135 t.datetime "created_at", null: false
136 t.datetime "updated_at", null: false
137 t.integer "cool_ribbons", default: 0, null: false
138 t.integer "beauty_ribbons", default: 0, null: false
139 t.integer "cute_ribbons", default: 0, null: false
140 t.integer "smart_ribbons", default: 0, null: false
141 t.integer "tough_ribbons", default: 0, null: false
142 t.boolean "champion_ribbon", default: false
143 t.boolean "winning_ribbon", default: false
144 t.boolean "victory_ribbon", default: false
145 t.boolean "artist_ribbon", default: false
146 t.boolean "effort_ribbon", default: false
147 t.boolean "marine_ribbon", default: false
148 t.boolean "land_ribbon", default: false
149 t.boolean "sky_ribbon", default: false
150 t.boolean "country_ribbon", default: false
151 t.boolean "national_ribbon", default: false
152 t.boolean "earth_ribbon", default: false
153 t.boolean "world_ribbon", default: false
154 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"
156 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"
158 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"
160 end
161
162 create_table "pokeviewer_species", force: :cascade do |t|
163 t.string "name", limit: 191, null: false
164 t.datetime "created_at", null: false
165 t.datetime "updated_at", null: false
166 t.string "type_1", null: false
167 t.string "type_2"
168 t.integer "ability_1_id", null: false
169 t.integer "ability_2_id"
170 t.index ["name"], name: "index_pokeviewer_species_on_name", unique: true
171 end
172
173 create_table "pokeviewer_trainers", force: :cascade do |t|
174 t.string "game", null: false
175 t.string "name", limit: 191, null: false
176 t.integer "number", null: false
177 t.datetime "created_at", null: false
178 t.datetime "updated_at", null: false
179 t.integer "marine_ribbon_id"
180 t.integer "land_ribbon_id"
181 t.integer "sky_ribbon_id"
182 t.integer "country_ribbon_id"
183 t.integer "national_ribbon_id"
184 t.integer "earth_ribbon_id"
185 t.integer "world_ribbon_id"
186 t.string "box_1_name", null: false
187 t.string "box_2_name", null: false
188 t.string "box_3_name", null: false
189 t.string "box_4_name", null: false
190 t.string "box_5_name", null: false
191 t.string "box_6_name", null: false
192 t.string "box_7_name", null: false
193 t.string "box_8_name", null: false
194 t.string "box_9_name", null: false
195 t.string "box_10_name", null: false
196 t.string "box_11_name", null: false
197 t.string "box_12_name", null: false
198 t.string "box_13_name", null: false
199 t.string "box_14_name", null: false
200 t.index ["country_ribbon_id"], name: "index_pokeviewer_trainers_on_country_ribbon_id"
201 t.index ["earth_ribbon_id"], name: "index_pokeviewer_trainers_on_earth_ribbon_id"
202 t.index ["land_ribbon_id"], name: "index_pokeviewer_trainers_on_land_ribbon_id"
203 t.index ["marine_ribbon_id"], name: "index_pokeviewer_trainers_on_marine_ribbon_id"
204 t.index ["name", "number"], name: "index_pokeviewer_trainers_on_name_and_number", unique: true
205 t.index ["national_ribbon_id"], name: "index_pokeviewer_trainers_on_national_ribbon_id"
206 t.index ["sky_ribbon_id"], name: "index_pokeviewer_trainers_on_sky_ribbon_id"
207 t.index ["world_ribbon_id"], name: "index_pokeviewer_trainers_on_world_ribbon_id"
208 end
209
37 create_table "records", force: :cascade do |t| 210 create_table "records", force: :cascade do |t|
38 t.text "description" 211 t.text "description"
39 t.string "recordable_type", limit: 191 212 t.string "recordable_type", limit: 191
@@ -57,8 +230,10 @@ ActiveRecord::Schema.define(version: 20170703013609) do
57 t.string "last_sign_in_ip" 230 t.string "last_sign_in_ip"
58 t.datetime "created_at", null: false 231 t.datetime "created_at", null: false
59 t.datetime "updated_at", null: false 232 t.datetime "updated_at", null: false
233 t.string "pokeviewer_token", limit: 191
60 t.index ["email"], name: "index_users_on_email", unique: true 234 t.index ["email"], name: "index_users_on_email", unique: true
61 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
62 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
63 end 238 end
64 239
diff --git a/db/seeds.rb b/db/seeds.rb index 1beea2a..11823c8 100644 --- a/db/seeds.rb +++ b/db/seeds.rb
@@ -5,3 +5,4 @@
5# 5#
6# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) 6# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7# Character.create(name: 'Luke', movie: movies.first) 7# Character.create(name: 'Luke', movie: movies.first)
8Pokeviewer::Engine.load_seed \ No newline at end of file