表題の件ですが、railsでmigrateしたときに以下のエラーが発生します。
※環境はdockerです。
I, [2020-03-13T07:29:52.679222 #1] INFO -- : Raven 2.7.2 ready to catch errors D, [2020-03-13T07:29:53.670694 #1] DEBUG -- : (0.4ms) SELECT DATABASE() as db D, [2020-03-13T07:29:53.674314 #1] DEBUG -- : (0.8ms) SELECT GET_LOCK('6406354277684579820', 0); D, [2020-03-13T07:29:53.732199 #1] DEBUG -- : ActiveRecord::SchemaMigration Load (1.6ms) SELECT `schema_migrations`.* FROM `schema_migrations` I, [2020-03-13T07:29:53.776320 #1] INFO -- : Migrating to CreateSpots (20191128074420) == 20191128074420 CreateSpots: migrating ====================================== -- create_table(:spots) D, [2020-03-13T07:29:53.809101 #1] DEBUG -- : (0.8ms) SELECT RELEASE_LOCK('6406354277684579820') I, [2020-03-13T07:29:53.964024 #1] INFO -- : Sending event 451184f1877949528cc841364780031a to Sentry D, [2020-03-13T07:29:54.007799 #1] DEBUG -- : Raven HTTP Transport connecting to https://sentry.console.shiori-tabi.jp rails aborted! StandardError: An error has occurred, all later migrations canceled: Index name 'index_spots_on_img_id' on table 'spots' already exists /usr/local/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:1145:in `add_index_options' /usr/local/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/mysql/schema_creation.rb:61:in `index_in_create'
rails db:migrate:status
をコマンドすると、以下になります。
up 20190216195325 Add visible h3 in toc to post up 20190415135538 Add pagetype to ad statics up 20190427155538 Add pagetype to ad statics 2 up 20191116152900 Add writer to post comments down 20191128074420 Create spots down 20191201123519 Create stations down 20191201130049 Add column spots down 20191205102956 Create spot comments down 20191207085550 Remove lon deg from stations down 20191207085733 Add column to stations
20191128074420 Create spots
このファイルが原因なのかなと見てるのですが、何がダメなのかわかりません。。。
class CreateSpots < ActiveRecord::Migration[5.0] def change create_table :spots do |t| t.string :title t.text :description t.string :area_tag t.string :category_tag t.string :address t.string :access t.string :lat_deg t.string :lon_deg t.string :tell t.references :img t.string :official_url t.string :timestamps end end end
というか、別のpcでは問題なくmigrateできています。
お分かりの方がいらっしゃれば、ご教授いただけませんでしょうか。
よろしくお願いします。。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。