File tree Expand file tree Collapse file tree
diesel_migrations/migrations_macros/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,6 +95,24 @@ use proc_macro::TokenStream;
9595/// Ok(())
9696/// }
9797/// ```
98+ ///
99+ /// # Automatic rebuilds
100+ ///
101+ /// Due to limitations in rusts proc-macro API there is currently no
102+ /// way to signal that a specific proc macro should be rerun if some
103+ /// external file changes/is added. This implies that `embed_migrations!`
104+ /// cannot regenerate the list of embedded migrations if **only** the
105+ /// migrations are changed. This limitation can be solved by adding a
106+ /// custom `build.rs` file to your crate, such that the crate is rebuild
107+ /// if the migration directory changes.
108+ ///
109+ /// Add the following `build.rs` file to your project to fix the problem
110+ ///
111+ /// ```
112+ /// fn main() {
113+ /// println!("cargo:rerun-if-changed=path/to/your/migration/dir/reletive/to/your/Cargo.toml");
114+ /// }
115+ /// ```
98116#[ proc_macro]
99117pub fn embed_migrations ( input : TokenStream ) -> TokenStream {
100118 embed_migrations:: expand ( input. to_string ( ) )
You can’t perform that action at this time.
0 commit comments