Forum: Ruby on Rails Alter sequence postgresql + rails

Posted by Guilherme Rodrigues (Guest)
on 2012-11-19 18:13
(Received via mailing list)
Hello. I would like to rename any sequence in my database, because I 
rename
table, but yours sequence I don't know rename. Have rename with one
migration?
For example: rename_sequence :conta_id_seq, :account_id_seq??
Thank you.
Posted by Colin Law (Guest)
on 2012-11-19 18:19
(Received via mailing list)
On 19 November 2012 16:36, Guilherme Rodrigues <lopesgrml@gmail.com> 
wrote:
> Hello. I would like to rename any sequence in my database, because I rename
> table, but yours sequence I don't know rename. Have rename with one
> migration?
> For example: rename_sequence :conta_id_seq, :account_id_seq??

If you are trying to rename a column then you want rename_column, so
something like
  rename_column :the_table_name, :conta_id_seq, :account_id_seq
It is a bit unusual to have column names like that, account_id would
be more usual if that is holding the id of something in the accounts
table.

Colin
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.