Advice on how to move from diesel migrator to sqlx migrator

Hello, does anyone know how sqlx migrator works? I already have migrations (by diesel migrator), but ofc sqlx migrator cannot see them. Maybe I can write one last diesel migration that will initialize stuff for sqlx migrator?

Or there is a better approach?

Maybe there is some available migration from diesel to sqlx?

Diesel:

# \d __diesel_schema_migrations
                    Table "public.__diesel_schema_migrations"
 Column  |            Type             | Collation | Nullable |      Default
---------+-----------------------------+-----------+----------+-------------------
 version | character varying(50)       |           | not null |
 run_on  | timestamp without time zone |           | not null | CURRENT_TIMESTAMP
Indexes:
    "__diesel_schema_migrations_pkey" PRIMARY KEY, btree (version)

# select * from __diesel_schema_migrations;
    version     |           run_on
----------------+----------------------------
 00000000000000 | 2024-10-28 14:05:23.883257
 20231009122722 | 2024-10-28 14:05:23.888459
 20231123131739 | 2024-10-28 14:05:23.953726
 20231127082500 | 2024-10-28 14:05:23.957411
 20240523092858 | 2024-10-28 14:05:23.959676
 20240523105549 | 2024-10-28 14:05:23.968349
 20240917120233 | 2024-10-28 14:05:23.970674
 20241001095844 | 2024-10-28 14:05:23.972661
 20241002084527 | 2024-10-28 14:05:24.005265
 20241002114034 | 2024-10-28 14:05:24.033134
 20241002114942 | 2024-10-28 14:05:24.042306
 20241003103022 | 2024-10-28 14:05:24.050735
 20241017132632 | 2024-10-28 14:05:24.05365
 20241017161833 | 2024-10-28 14:05:24.05715
 20241019122504 | 2024-10-28 14:05:24.059316
 20241023082725 | 2024-10-28 14:05:24.068056
 20241025102258 | 2024-10-28 14:05:24.070638
 20241027123004 | 2024-10-28 14:05:24.074919
 20241027163403 | 2024-10-28 14:05:24.077464
(19 rows)

Sqlx:

sqlx_test=# \d _sqlx_migrations
                      Table "public._sqlx_migrations"
     Column     |           Type           | Collation | Nullable | Default
----------------+--------------------------+-----------+----------+---------
 version        | bigint                   |           | not null |
 description    | text                     |           | not null |
 installed_on   | timestamp with time zone |           | not null | now()
 success        | boolean                  |           | not null |
 checksum       | bytea                    |           | not null |
 execution_time | bigint                   |           | not null |
Indexes:
    "_sqlx_migrations_pkey" PRIMARY KEY, btree (version)

sqlx_test=# select * from _sqlx_migrations
sqlx_test-# ;
    version     | description |         installed_on          | success |                                              checksum                                              | execution_time
----------------+-------------+-------------------------------+---------+----------------------------------------------------------------------------------------------------+----------------
 20241030101117 | test        | 2024-10-30 11:12:06.102341+01 | t       | \xb80719b123cd713cf0db19610fc44326c1d7cc0645b1344d89dc67a0c84dc758981210ca0a93381ccce10dd9f51e7a4c |       23290894
(1 row)

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.