Macro refinery::embed_migrations[][src]

embed_migrations!() { /* proc-macro */ }
Expand description

Interpret Rust or SQL migrations and inserts a function called runner that when called returns a Runner instance with the collected migration modules.

When called without arguments embed_migrations searches for migration files on a directory called migrations at the root level of your crate. if you want to specify another directory call embed_migrations! with it’s location relative to the root level of your crate.

To be a valid migration module, it has to be named in the format V{1}__{2}.{3} where {1} represents the migration version and {2} the name and {3} is "rs" or "sql". For the name alphanumeric characters plus "_" are supported. The Rust migration file must have a function named migration() that returns a [std::string::String`]. The SQL migration file must have valid sql instructions for the database you want it to run on.