TypeORM Postgres Migration with sequence instead auto-increment

Viewed 892

I have a column "code" that is not PK and will start from 1000 and increase by 10. I made a sequence "code_seq" at a database like this:

CREATE SEQUENCE public.code_seq
    INCREMENT 10
    START 1000
    MINVALUE 1000
    MAXVALUE 9999999999
    CACHE 1; 

I want to set as default, like:

CREATE TABLE trouble(
id INTEGER, 
code DEFAULT NEXTVAL('public.code_seq'), 

How to do that using typeorm migration?

0 Answers
Related