質問編集履歴

2

修正

2020/08/30 00:46

投稿

tomsuma
tomsuma

スコア38

test CHANGED
File without changes
test CHANGED
@@ -151,3 +151,71 @@
151
151
  end
152
152
 
153
153
  ```
154
+
155
+
156
+
157
+ ```
158
+
159
+ rollback
160
+
161
+
162
+
163
+ heroku run rails db:rollback
164
+
165
+ Running rails db:rollback on ⬢ books-28291... up, run.1599 (Free)
166
+
167
+ DEPRECATION WARNING: Including LoggerSilence is deprecated and will be removed in Rails 6.1. Please use `ActiveSupport::LoggerSilence` instead (called from <main> at /app/config/application.rb:7)
168
+
169
+ (2.1ms) SET NAMES utf8, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
170
+
171
+ (3.7ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
172
+
173
+ (2.0ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
174
+
175
+ (2.0ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
176
+
177
+ rails aborted!
178
+
179
+ ActiveRecord::UnknownMigrationVersionError:
180
+
181
+
182
+
183
+ No migration with version number 20200811131113.
184
+
185
+
186
+
187
+ /app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.2/lib/active_record/migration.rb:1169:in `move'
188
+
189
+ /app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.2/lib/active_record/migration.rb:1047:in `rollback'
190
+
191
+ /app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.2/lib/active_record/railties/databases.rake:225:in `block (2 levels) in <main>'
192
+
193
+ /app/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.2/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
194
+
195
+ /app/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.2/lib/rails/commands/rake/rake_command.rb:20:in `perform'
196
+
197
+ /app/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.2/lib/rails/command.rb:48:in `invoke'
198
+
199
+ /app/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.2/lib/rails/commands.rb:18:in `<main>'
200
+
201
+ /app/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
202
+
203
+ /app/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
204
+
205
+ /app/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
206
+
207
+ /app/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
208
+
209
+ /app/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
210
+
211
+ /app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `block in require'
212
+
213
+ /app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency'
214
+
215
+ /app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `require'
216
+
217
+ /app/bin/rails:9:in `<main>'
218
+
219
+ Tasks: TOP => db:rollback
220
+
221
+ ```

1

修正

2020/08/30 00:46

投稿

tomsuma
tomsuma

スコア38

test CHANGED
File without changes
test CHANGED
@@ -67,3 +67,87 @@
67
67
 
68
68
 
69
69
  heroku run rails db:migrate:resetもダメでした。。
70
+
71
+ ```
72
+
73
+ ActiveRecord::ProtectedEnvironmentError: You are attempting to run a destructive action against your 'production' database.
74
+
75
+ If you are sure you want to continue, run the same command with the environment variable:
76
+
77
+ DISABLE_DATABASE_ENVIRONMENT_CHECK=1
78
+
79
+ /app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.2/lib/active_record/tasks/database_tasks.rb:63:in `check_protected_environments!'
80
+
81
+ /app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.2/lib/active_record/railties/databases.rake:15:in `block (2 levels) in <main>'
82
+
83
+ /app/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.2/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
84
+
85
+ /app/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.2/lib/rails/commands/rake/rake_command.rb:20:in `perform'
86
+
87
+ /app/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.2/lib/rails/command.rb:48:in `invoke'
88
+
89
+ /app/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.2/lib/rails/commands.rb:18:in `<main>'
90
+
91
+ /app/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
92
+
93
+ /app/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
94
+
95
+ /app/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
96
+
97
+ /app/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
98
+
99
+ /app/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
100
+
101
+ /app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `block in require'
102
+
103
+ /app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency'
104
+
105
+ /app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `require'
106
+
107
+ /app/bin/rails:9:in `<main>'
108
+
109
+ Tasks: TOP => db:migrate:reset => db:drop => db:check_protected_environments
110
+
111
+ (See full trace by running task with --trace)
112
+
113
+ ```
114
+
115
+
116
+
117
+ ```
118
+
119
+ schema.rb
120
+
121
+
122
+
123
+ create_table "favorites", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
124
+
125
+ t.integer "user_id"
126
+
127
+ t.integer "book_id"
128
+
129
+ t.datetime "created_at", precision: 6, null: false
130
+
131
+ t.datetime "updated_at", precision: 6, null: false
132
+
133
+ t.index ["user_id", "book_id"], name: "index_favorites_on_user_id_and_book_id", unique: true
134
+
135
+ end
136
+
137
+
138
+
139
+ create_table "messages", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
140
+
141
+ t.text "text"
142
+
143
+ t.bigint "book_id"
144
+
145
+ t.bigint "user_id"
146
+
147
+ t.datetime "created_at", precision: 6, null: false
148
+
149
+ t.datetime "updated_at", precision: 6, null: false
150
+
151
+ end
152
+
153
+ ```