Recover Table Data After Unintentional Migration in Retool

Goal

I am trying to recover data from my canais table that was lost after an incorrect migration. The expected behavior is to restore the table to its previous state of before the schema migration, including all the dropped columns and their data.

Steps

I executed the following migration on the canais table approximately 16 hours ago:

ALTER TABLE canais
    ALTER COLUMN nome_canal DROP NOT NULL,
    DROP COLUMN logo,
    DROP COLUMN img_estaiada,
    DROP COLUMN owner,
    DROP COLUMN cnpj,
    DROP COLUMN tipo_parceiro,
    DROP COLUMN razao_social,
    DROP COLUMN partner_id,
    ADD COLUMN fator numeric NOT NULL DEFAULT '1'::numeric;

After this migration, the columns mentioned above were dropped, and I realized that I lost critical data associated with these columns.

What I’ve done so far:

  • Checked database backups for possible recovery options but have limited success in retrieving the data.
  • Consulted the Retool Documentation for rollback options or ways to restore data.
  • Attempted to manually reverse the migration but dind't find the option.

Details

The migration affected several critical columns (logo, img_estaiada, owner, cnpj, tipo_parceiro, razao_social, and partner_id), which are essential for my app's functionality. I need guidance on whether:

  1. Retool or my database has any inherent rollback mechanism for such cases.
  2. There are tools or best practices for recovering the data that was lost.
  3. Retool logs or app metadata could help in retrieving the data.

Screenshots

Here’s a screenshot of the current state of the canais table and the migration code that caused the issue:


image

Please help @Tess @Paulo :pray:

I forgot to mention, our workspace is https://estaiada.retool.com/

Hi @livio-estaiada,

Thanks for reaching out!

I can rollback your database for you (similarly to this request). Please note that this will reset to a past state of the database; any new records or updates would be rolled back as well. Could you please provide a specific date & time (hours, minutes, seconds) that you want to rollback to? Please also let me know which environment. We can only rollback within a 7 day window.

As noted in our docs, the best practice is to implement a secondary backup process that stores and retains data for a longer period of time as an additional guardrail.

1 Like

I see you were able to speak with another Retool about this :blush: Let me know if I can help with anything else