I'm migrating tables from Retool's cloud to self-hosted instance. Following Retool's instructions, I had to export each table as CSV then reimport it to the self-hosted database. However, I realized that the serial behind the id primary key no longer exists when I import the data. It forces me to have to create the table from scratch, with each of its fields, before importing the data to retain the id sequence. Can someone advise if there's a faster way to just import the data and have the id sequence already there as the default value? If I try to type it in manually, it also throws an error (ex. import a table called "customers", the id default value is set to none, set the default value to customers_id_seq, Retool throws an error). This would save me a ton of time when migrating tables!
@tiffany I'm facing similar issues. I've had to do quite a bit of work in Google Sheets to recreate a lot of foreign key relationships etc.
I don't have a solution but I feel your pain!
Nick
Hi all! In cases like this - when you are moving data from an existing database to a brand new one - I would recommend using the approach described here.
You can grab the connection string for your existing RetoolDB via the UI, as shown below, and run the pg_dump EXISTING_DATABASE_CONNECTION_STRING > pg_dump.sql
command on your local machine.
The resulting pg_dump.sql
file can then be applied to your new database with the command psql NEW_DATABASE_CONNECTION_STRING < pgdump.sql
. This will recreate all tables from scratch, including the necessary key sequences.
I hope that helps! Let me know if you have any questions.