rails/rails — pull request #6874 by robbkidd (2012-06-27 04:39:21+00:00)
Title: Rename default sequence when table is renamed? [AR:postgres]

Does it make sense to rename the default primary key sequence when a table is renamed?

As it is, if I ```rename_table :foo, :bar```, I end up with a table name "bar" whose id column is incremented by a sequence named "foo_id_seq". The names being out of sync complicates things when multiple DB users are used in production (e.g. one user for migrations and one user for app connections).

Attached is proposed crazy sauce which renames the primary key sequence if its name matches the default PK sequence created by the adapter.