sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

migration feature is not documented well enough

Open e00E opened this issue 3 years ago • 1 comments

Readme:

migrate: Add support for the migration management and migrate! macro, which allow compile-time embedded migrations.

migrate! macro documentation:

See MigrationSource for details on structure of the ./migrations directory.

MigrationSource appears to have no documentation whatsoever. I have to notice the plus button on this impl image to read the documentation that does exist:

The path has to point to a directory, which contains the migration SQL scripts. All these scripts must be stored in files with names using the format <VERSION>_<DESCRIPTION>.sql, where <VERSION> is a string that can be parsed into i64 and its value is greater than zero, and <DESCRIPTION> is a string.

This still does not give enough context to understand this feature. For example some relevant details are hidden in the implementation details of MigrationType::from_filename and I have to read the implementation of ensure_migration_table to hear about the _sqlx_migrations table. There are likely more undocumented details like this.

I might still be able to use this feature with the examples and source code but I expect more complete documentation. I found some more documentation in the sqlx-cli Readme but this isn't linked from the the sqlx library documentation and still not complete.

e00E avatar Jun 28 '22 11:06 e00E

PRs are always welcome.

abonander avatar Jul 11 '22 20:07 abonander