You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
... a MigrationSource is a directory which contains the migration SQL scripts. All these scripts must be stored in files with names using the format _.sql, where is a string that can be parsed into i64 and its value is greater than zero, and is a string.
The solution is actually very simple. All you need to do is add the prefix 1_ to the filename. So rename ./migrations/schema.sql to ./migrations/1_schema.sql. After I applied this fix locally I was able to confirm that the todos table was created and everything worked as expected.
The text was updated successfully, but these errors were encountered:
albrow
changed the title
Issue on docs
Issue on docs: Migrations are not running in the Axum Postgres Todo App
Nov 1, 2023
Path: /examples/axum-postgres
Following the instructions and sending a POST or GET request to the server results in the following error:
I manually connected to the database via the
psql
CLI and I can see that thetodos
table was not created.This is happening because the migration filename is not formatted correctly. The documentation for sqlx
MigrationSource
explains:The solution is actually very simple. All you need to do is add the prefix
1_
to the filename. So rename./migrations/schema.sql
to./migrations/1_schema.sql
. After I applied this fix locally I was able to confirm that thetodos
table was created and everything worked as expected.The text was updated successfully, but these errors were encountered: