I just renamed my table Client to Person using this command:
class RenameClientsToPeople < ActiveRecord::Migration
def change
rename_table :clients, :people
end
end
I carefully renamed all instances and filenames from client to person and from clients to people. But for some reason my app won’t work anymore. I constantly get errors like this:
SQLite3::SQLException: no such column: projects.person_id: SELECT COUNT(*) FROM "projects" INNER JOIN "people" ON "projects"."person_id" = "people"."person_id" WHERE "people"."user_id" = 1
Can anybody tell me how to fix this?
Maybe I should re-create the Person model from scratch instead of just renaming it?
You also need to rename all your foreign keys from
client_idtoperson_id, and it looks like you’ve neglected to do this. In that migration, you’ll want to do something like this:Do that for every column that referenced
client_id.