lomba/schema_plus — pull request #87 by teleological (2013-01-18 22:52:05+00:00)
Title: When renaming tables, rename constraints

AbstractAdapter currently tries to rename any foreign key constraints to the new name of the table. For tables with more than one constraint, this results in an error like this:

PG::Error: ERROR: constraint "new_table_name" for relation "new_table_name" already exists
: ALTER TABLE "new_table_name" ADD CONSTRAINT new_table_name FOREIGN KEY ("other_table_id") REFERENCES "other_table" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION

This patch restores the previous behavior of renaming the constraint by substituting the new table name for the old table name in the constraint name.