How can I set the starting point for the primary key (ID) column in Postgres via a rails migration

前端 未结 2 1606
离开以前
离开以前 2020-12-30 12:05

I am deploying a rails app to heroku which uses PostgreSQL as its back-end. In my database migration I normally set the ID field for things likes reports etc to at least 100

2条回答
  •  再見小時候
    2020-12-30 12:39

    Have no idea about rubies and railroads part, but query you're talking about is

    ALTER SEQUENCE reports_something_seq RESTART 1000;
    

    You will have to look up your table for the sequence name and postgresql documentation for general education regarding the matter ;-)

提交回复
热议问题