Macro diesel::embed_migrations
[−]
[src]
macro_rules! embed_migrations { () => { ... }; ($migrations_path: expr) => { ... }; }
This macro will read your migrations at compile time, and embed a module you can use to execute them at runtime without the migration files being present on the file system. This is useful if you would like to use Diesel's migration infrastructure, but want to ship a single executable file (such as for embedded applications). It can also be used to apply migrations to an in memory database (Diesel does this for its own test suite).
You can optionally pass the path to the migrations directory to this macro. When left
unspecified, Diesel Codegen will search for the migrations directory in the same way that
Diesel CLI does. If specified, the path should be relative to the directory where Cargo.toml
resides.
This macro can only be used in combination with the diesel_codegen
or
diesel_codegen_syntex
crates. It will not work on its own.