레일즈 5 어플리케이션에서 실수로 데이터 타입이없는 컬럼을 생성했습니다. 데이터베이스는 SQLite입니다. 나는이 마이그레이션을 실행하려고했습니다레일즈 데이터 타입이없는 컬럼을 제거합니다
Rhys-MacBook-Pro:classmaster Rhys$ rails db:rollback == 20161011105423 AddActivitiesRefToStudents: reverting =======================
-- remove_column(:students, :activity, :reference)
rails aborted! StandardError: An error has occurred, this and all later migrations canceled: undefined method `to_sym' for nil:NilClass
: 나는 rails db:rollback
을 시도 할 때
create_table "students", force: :cascade do |t|
t.integer "club_id"
t.string "email"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "picture"
t.integer "payment_plan_id"
t. "activity"
t.index ["club_id"], name: "index_students_on_club_id"
end
는이 오류 얻을
class RemoveColumn < ActiveRecord::Migration
def up
execute "ALTER TABLE students DROP COLUMN activity";
end
end
을하지만 SQLite는이 떨어지고 열을 지원하지 않습니다 생각합니다. 이 문제가 수정 되었습니까?
열을 삭제하는 대신 데이터 유형을 설정하기 위해'change_column'을 사용해보십시오. –