DB Migration PK Issue

Hey team,

Migrating schema using built in migration tool doesn't initiate PK auto-increment functionality.

Tables end up being created with all FK's and PK but auto-increment is lost.

Hello @stefancvrkotic!

Apologies for the issue. One of my team mates mentioned to me that this issues has popped up for other users so I will look for a solution of the forums right now.

Just to confirm, this is your self-hosted version of Retool DB(Postgres under the hood).

Talking with a team mate it seems that the built in migration tools to not set the config for the new table receiving the migrations to have auto-increment. Which will need to be manually set.

This is definitely not a smooth developer experience so I will look to file a request to have the built in migration tool set increment to be ON by default.

To fix this, you may need to re-make the table, set auto-increment to be on for the PK, and then run the migrations.

Correct, though this is a bug with cloud version of Retool as well.

1 Like

Ok good to know.

I can file a bug report for this. If you go to manually add a row to Retool DB with the GUI does it give you an autofill option for the PK ID that does auto increment?

Or is the PK ID field empty from this GUI modal after the migration occurs?

Been a while since this but IIRC it creates PK column correctly, but auto-increment is not there so when users try to insert a record they get an error that ID cannot be null due to auto-increment missing.

Ah ok good to know.

Apologies again for the issue. The engineering team has seen the ticket and agree this fix would be a great improvement for the table.

Is it currently not possible to re-activate the auto-increment?

You can manually create the auto-increment though it's confusing for vast majority of Retool users.

I'm fine with it being as is as I know the bug exists though for sake of other developers I think it comes off as unexpected or buggy.

I completely agree, this is not the user experience we want.

We are comitted to make Retool easier and more intuitive to use :sweat_smile:

Our engineers have eyes on this and are putting it as a medium priority to work on right away. So that after migration auto increment is automatically working without any errors or manual re-activation.

Will update you on any news regarding this ticket!