I am trying to copy my database from one server to another (postgres10). I have tried using the interface of pgadmin4 to take a backup, create empty database on the new server and use the interface restore option. This is the first time I have tried to move to a new server so I am not very experienced. The data got copied to the new server but the sequence was not, so when I try to insert a new item to the database the not null restriction makes it invalid.
Instead I tried to use the command line to backup and restore the database with these commands.
pg_dump -U postgres -Fc my_db > my_db.db pg_restore -h <ip remote server> -p <port remote server> -U postgres -C my_db.db
While this worked to copy the data over, the issue still persist with sequence. I have seen similar posts about this issue but not found anyone who has actually solved the problem. Is this a difficult task to complete? What I want is to copy by database over just as it is to another server.