Closed ghost closed 14 years ago
you are trying to use foreigner with the migration. stop trying to add a foreign key constraint to the table. you cant do that with a polymorphic relation.
I'm not familiar with foreigner. Are you saying that the indexes on the versioned_id
and versioned_type
columns are somehow breaking the migration on PostrgreSQL? Seems like this is a pretty standard migration. Could you elaborate a bit more on the issue?
no. the migration is fine.
http://github.com/matthuhiggins/foreigner/ foreigner is a plugin to allow the creation of foreign key constraints in the database (as rails doesn't do this.)
FOREIGN KEY (versioned_id) REFERENCES versioneds (id)
is trying to create a foreign key constraint. he needs to disable foreigner for this migration (which im pretty sure is off by default.)
I have foreigner activated on my project as well and the default vestal versions (0.8.3) migration does NOT cause foreigner to attempt and make a foreign key constraint. v_v uses belongs_to, which foreigner doesnt affect in anyway at all.
he has to be using a modified vestal_versions, OR modified foreigner, OR modified the migration, OR using another foreign key creation plugin thats more intrusive than it maybe should be. if thats the case he should look into a way to disable the creation for just the vestal_versions migration.
Simply put. this is NOT a bug / issue with vestal_versions.
Okay thanks for the clarification, zacheryph. Closing.
Thanks! Yes, I have a very old foreign key plugin installed on this system. I forget it was even there.
"foreign_key_migrations" plugin
I'm trying to install this today and I can't get past the rake db:migrate step.
PGError: ERROR: relation "versioneds" does not exist : CREATE TABLE "versions" ("id" serial primary key, "versioned_id" integer, "versioned_type" character varying(255), "changes" text, "number" integer, "created_at" timestamp, FOREIGN KEY (versioned_id) REFERENCES versioneds (id))