テーブルのカラム名を変更してrake db:migrateを実行したところ、以下のエラーがでて対処方法がわかりません。どのように対応するべきか教えていただけませんか?
エラー画面引用ここから
== 20170627064443 ChangeOpstartdateToBasicInfos: migrating ====================
-- change_column(:basic_infos, :opstartdate, :string)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: object name reserved for internal use: sqlite_autoindex_basic_infos_1: CREATE UNIQUE INDEX "sqlite_autoindex_basic_infos_1" ON "basic_infos" ("unitid")
/home/ryonishida/workspace/boiler_kyosho/db/migrate/20170627064443_change_opstartdate_to_basic_infos.rb:3:in change' ActiveRecord::StatementInvalid: SQLite3::SQLException: object name reserved for internal use: sqlite_autoindex_basic_infos_1: CREATE UNIQUE INDEX "sqlite_autoindex_basic_infos_1" ON "basic_infos" ("unitid") /home/ryonishida/workspace/boiler_kyosho/db/migrate/20170627064443_change_opstartdate_to_basic_infos.rb:3:in
change'
SQLite3::SQLException: object name reserved for internal use: sqlite_autoindex_basic_infos_1
/home/ryonishida/workspace/boiler_kyosho/db/migrate/20170627064443_change_opstartdate_to_basic_infos.rb:3:in `change'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
エラー画面引用ここまで
ちなみにテーブルのカラムデータ型は以下のファイルで指定しております。(date型→string型)
参考にしたサイトは以下です。
http://qiita.com/Kaki_Shoichi/items/077d0a282255cd92cff3
Ruby
1 2class ChangeOpstartdatebToBasicInfos < ActiveRecord::Migration[5.0] 3 4 def up 5 change_column :basic_infos, :opstartdate, :string 6 end 7 8 def down 9 change_column :basic_infos, :opstartdate, :date 10 end 11 12end 13
あなたの回答
tips
プレビュー