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
Currently the migration generator is somewhat hacky in the sense that it parses raw Rust source files and ignores things like macros, some weirder syntaxes, etc. use statements are parsed, but not perfectly, which might result in generating migrations that need manual changes to compile. What might be the worst is that it cannot access any actual type/constant data, so the migrations must include stuff like below:
(which is equivalent to .set_null(false) at compile time).
I would be ideal to use something closer to the the actual Rust compiler to parse models in the CLI, so we have access to full data about the types used in the project.
Some options that are worth considering:
rust-analyzer - basically a Rust compiler with a nice API. LSP protocol might be somewhat cumbersome to get what we need, but it's possible we should be able to get the data we want.
cargo +nightly rustdoc -- -Z unstable-options --output-format json - generates a JSON file which annotates fields in the structures with the actual types they use. Might be useful, but it doesn't seem to resolve constant or associated types, so its usefulness is probably somewhat limited (more investigation might be needed).
Currently the migration generator is somewhat hacky in the sense that it parses raw Rust source files and ignores things like macros, some weirder syntaxes, etc.
use
statements are parsed, but not perfectly, which might result in generating migrations that need manual changes to compile. What might be the worst is that it cannot access any actual type/constant data, so the migrations must include stuff like below:(which is equivalent to
.set_null(false)
at compile time).I would be ideal to use something closer to the the actual Rust compiler to parse models in the CLI, so we have access to full data about the types used in the project.
Some options that are worth considering:
cargo +nightly rustdoc -- -Z unstable-options --output-format json
- generates a JSON file which annotates fields in the structures with the actual types they use. Might be useful, but it doesn't seem to resolve constant or associated types, so its usefulness is probably somewhat limited (more investigation might be needed).The text was updated successfully, but these errors were encountered: