Bug in UUID Reference Handling Between Tables in Wappler

Wappler Version: 6.8.0
Operating System: Mac
Server Model: Node.Js
Database Type: Postgresql
Hosting Type: Docker

Expected behavior
The reference type should be correctly identified as UUID when creating relationships between tables that use UUID as the primary key.

Actual behavior
When setting the primary key to UUID and creating tables (e.g., Users and Companies), both with an ID of type UUID, trying to create a reference between the tables results in an error. The migration script incorrectly identifies the reference type as an integer instead of UUID, causing the issue.

How to reproduce
Set the primary key of a table to UUID.
Create two tables, such as Users and Companies, both with UUID as the primary key.
Attempt to create a reference from Users to Companies.
Observe the error in the migration script where the reference type is incorrectly identified as an integer.
Please note: I was able to work around this issue by editing the migration script manually, rolling back, and reapplying it. However, this is not a sustainable solution for the future.

Images -

1 Like

I just ran into this as well. What exactly did you type to change the type from integer to UUID reference? (it looks like just table.integer > table.uuid and remove .unsigned())

Then how did you run/apply the edited migration script?

Thanks for your help.

2 Likes
table.uuid('column_name').unsigned();
table.foreign('column_name').references('id').inTable('Companies');

Helloooo

I resolved the issue by first creating the table normally with a migration. After that, I went back to the migration script and added the two lines of code mentioned above. Then, I reverted to the previous migration and applied it again. This approach worked perfectly for me.

I'm at work now, but if I need it later I can take screenshots showing how I did it, I'm not sure if the way is very correct but it works.

1 Like

There are a few isdues relating to UUIDs, also this

1 Like

This helped me actually a lot. Thank you so much for this short answer!
(I am serious, this is no irony).