Hi,
I’m trying to use diesel with yugabyte. Everything seems to works well so far but I got one issue (that I could fix but in a hacky way).
I made a github repo to reproduce my issue.
The issue happen when I try to do an ALTER TABLE
followed by a UPDATE
related to this table.
Here is and example of sql
-- init.sql
CREATE TABLE mytable (
id SERIAL PRIMARY KEY,
uuid character varying(44) UNIQUE
);
-- change_uuid.sql
ALTER TABLE mytable ALTER COLUMN uuid TYPE VARCHAR(44);
-- update_uuid.sql
UPDATE mytable
SET uuid = CONCAT(
SUBSTRING(uuid, 0, 8), '-',
SUBSTRING(uuid, 8, 8), '-',
SUBSTRING(uuid, 16, 8), '-',
SUBSTRING(uuid, 24, 8), '-',
SUBSTRING(uuid, 32, 8)
)
WHERE uuid IS NOT NULL;
If I execute them by hand everything seems fine. When I use diesel
something goes wrong and I got the message
❯ diesel migration run --database-url 'postgres://user:password@yb-tserver.local:5433/db1'
Running migration 2024-09-10-190931_init
Running migration 2024-09-10-191017_change_uuid
Running migration 2024-09-11-120055_update_uuid
Failed to run 2024-09-11-120055_update_uuid with: schema version mismatch for table 0000460a00003000800000000000400a: expected 3, got 2
I need to retry another time to finish the migration.
I am wondering what causing this issue and if I need to configure something in my yugabyte cluster (running in k8s with the default helm configuration)?