11155
(-- --)
1
Lance wrote in post #93083:
There is a method in the Postgresql adapter called reset_pk_sequence. I
haven't used it yet but it sounds like this is what you are looking for.
I used it:
Account.delete_all
Account.reset_pk_sequence
but, it didn't work. The next Account.save had the :id = last :id + 1
At least it didn't crash
I'm still looking for a solution.
11155
(-- --)
2
Bob Gustafson wrote in post #1092090:
Lance wrote in post #93083:
There is a method in the Postgresql adapter called reset_pk_sequence. I
haven't used it yet but it sounds like this is what you are looking for.
I used it:
Account.delete_all
Account.reset_pk_sequence
but, it didn't work. The next Account.save had the :id = last :id + 1
At least it didn't crash
I'm still looking for a solution.
Here is the solution:
Account.delete_all
Account.connection.execute "ALTER SEQUENCE accounts_id_seq RESTART WITH
1"
Hope this helps
Bob G