lmquang / til

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overcome postgres cannot import a table because of sequence

lmquang opened this issue · comments

CREATE TABLE two
( id bigint NOT NULL PRIMARY KEY
, name varchar
);
CREATE SEQUENCE "two_id_seq"
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
ALTER SEQUENCE "two_id_seq"
OWNED BY two.id
;
ALTER TABLE two
ALTER COLUMN id SET default nextval('two_id_seq')
;