I migrated some data from my old db to new one with pk(id). What should I do in order to my new db continue from last id of migrated data. I encounter no problem while migrating but when project is running, there is problem while adding new object to the db. Project is done in django
Question posted in PostgreSQL
The official documentation can be found here.
The official documentation can be found here.
2
Answers
You should change/alter the id of your table
you can use this command in Postgresql to set id to some specific id, and it will auto-increment from that value.
or
You can set the sequence of your pk automatically to the last number (if your pk is an auto-increment integer) with the following PostgreSQL command:
Change
<schema>
and<table_name>
to the correct values before running the command.