Last active
August 29, 2015 14:10
-
-
Save yurikoval/ada3a3e45afd160e183c to your computer and use it in GitHub Desktop.
Add sequence for PostgreSQL after migrating from MySQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE SEQUENCE feedbacks_id_seq; | |
ALTER TABLE feedbacks ALTER COLUMN id SET DEFAULT nextval('feedbacks_id_seq'::regclass); | |
ALTER SEQUENCE feedbacks_id_seq OWNED BY feedbacks.id; | |
select setval('feedbacks_id_seq', (select max(id)+1 from feedbacks), false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment