Interesting, I was just puzzling over a postgresql indexing question myself. The generated migration to create one of my tables automatically generated indexes on the foreign keys. However, after further considering my model, I want to make the index on one of these foreign keys unique. Is there any way for a migration to alter the index, or do I just have to delete the old index and create a new one? Based on what I've seen so far, it looks like I have to delete and recreate, but I wouldn't mind confirming that.
You mean on the from side? Yes, just drop the existing index and create a unique index. You can do that within the same transaction.
Postgres already requires the pointed to relation to have a unique index:
=> create table foo (id int); -- No unique index here.
CREATE TABLE
=> create index foo_id on foo(id);
CREATE INDEX
=> create table bar(foo int references foo(id));
ERROR: there is no unique constraint matching given keys for referenced table "foo"