質問編集履歴
3
マイグレーションファイルのソースコードを追記しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -182,11 +182,6 @@
|
|
182
182
|
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
|
183
183
|
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
|
184
184
|
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:200:in `block in execute'
|
185
|
-
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:722:in `block (2 levels) in log'
|
186
|
-
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
|
187
|
-
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
|
188
|
-
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
|
189
|
-
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
|
190
185
|
|
191
186
|
〜中略〜
|
192
187
|
|
@@ -204,7 +199,23 @@
|
|
204
199
|
(See full trace by running task with --trace)
|
205
200
|
|
206
201
|
```
|
202
|
+
11/03
|
203
|
+
20201030080618_create_post_bs.rb のソースコード記載しました。
|
204
|
+
```20201030080618_create_post_bs.rb
|
205
|
+
class CreatePostBs < ActiveRecord::Migration[6.0]
|
206
|
+
def change
|
207
|
+
create_table :post_bs do |t|
|
208
|
+
t.references :user,foreign_key: true
|
209
|
+
t.string :title,null: false
|
210
|
+
t.string :place,null: false
|
211
|
+
t.string :brand,null: false
|
212
|
+
t.text :story,null: false
|
213
|
+
t.text :evidence,null: false
|
214
|
+
t.timestamps
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
```
|
207
219
|
|
208
|
-
|
209
220
|
コンテナを新しく建てても内容は変わらず・・・。
|
210
221
|
もしこの状況が理解できる方がいらっしゃいましたらぜひ教えて下さい!
|
2
試したことの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -139,5 +139,72 @@
|
|
139
139
|
end
|
140
140
|
```
|
141
141
|
|
142
|
+
###追記
|
143
|
+
下記を追加で行いました。
|
144
|
+
・環境を指定してdb:migrateをしたところ、途中からエラーが発生しました。
|
145
|
+
|
146
|
+
```
|
147
|
+
$ docker-compose exec web rails db:migrate RAILS_ENV=development
|
148
|
+
|
149
|
+
== 20201023085758 DeviseCreateUsers: migrating ================================
|
150
|
+
-- create_table(:users)
|
151
|
+
-> 0.0416s
|
152
|
+
-- add_index(:users, :email, {:unique=>true})
|
153
|
+
-> 0.0420s
|
154
|
+
-- add_index(:users, :reset_password_token, {:unique=>true})
|
155
|
+
-> 0.0404s
|
156
|
+
== 20201023085758 DeviseCreateUsers: migrated (0.1245s) =======================
|
157
|
+
|
158
|
+
== 20201024235341 CreateActiveStorageTables: migrating ========================
|
159
|
+
-- create_table(:active_storage_blobs, {})
|
160
|
+
-> 0.0409s
|
161
|
+
-- create_table(:active_storage_attachments, {})
|
162
|
+
-> 0.0411s
|
163
|
+
== 20201024235341 CreateActiveStorageTables: migrated (0.0821s) ===============
|
164
|
+
|
165
|
+
== 20201026020750 CreatePostCs: migrating =====================================
|
166
|
+
-- create_table(:post_cs)
|
167
|
+
-> 0.0455s
|
168
|
+
== 20201026020750 CreatePostCs: migrated (0.0456s) ============================
|
169
|
+
|
170
|
+
== 20201030080618 CreatePostBs: migrating =====================================
|
171
|
+
-- create_table(:post_bs)
|
172
|
+
rails aborted!
|
173
|
+
StandardError: An error has occurred, all later migrations canceled:
|
174
|
+
|
175
|
+
Mysql2::Error: Tablespace '`mybest_development`.`post_bs`' exists.
|
176
|
+
/usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/client.rb:131:in `_query'
|
177
|
+
/usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/client.rb:131:in `block in query'
|
178
|
+
/usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/client.rb:130:in `handle_interrupt'
|
179
|
+
/usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/client.rb:130:in `query'
|
180
|
+
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:201:in `block (2 levels) in execute'
|
181
|
+
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
|
182
|
+
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
|
183
|
+
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
|
184
|
+
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:200:in `block in execute'
|
185
|
+
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:722:in `block (2 levels) in log'
|
186
|
+
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
|
187
|
+
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
|
188
|
+
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
|
189
|
+
/usr/local/bundle/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
|
190
|
+
|
191
|
+
〜中略〜
|
192
|
+
|
193
|
+
/usr/local/bundle/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
|
194
|
+
/usr/local/bundle/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
|
195
|
+
/usr/local/bundle/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
|
196
|
+
/usr/local/bundle/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
|
197
|
+
/usr/local/bundle/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
|
198
|
+
/usr/local/bundle/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
|
199
|
+
/usr/local/bundle/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
|
200
|
+
/myapp/bin/spring:15:in `<top (required)>'
|
201
|
+
bin/rails:3:in `load'
|
202
|
+
bin/rails:3:in `<main>'
|
203
|
+
Tasks: TOP => db:migrate
|
204
|
+
(See full trace by running task with --trace)
|
205
|
+
|
206
|
+
```
|
207
|
+
|
208
|
+
|
142
209
|
コンテナを新しく建てても内容は変わらず・・・。
|
143
210
|
もしこの状況が理解できる方がいらっしゃいましたらぜひ教えて下さい!
|
1
タイトルの編集を行いました。
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
docker
|
1
|
+
【docker環境】rails db:migrate時のエラーの対処法
|
body
CHANGED
File without changes
|