SeaQL / sea-orm

🐚 An async & dynamic ORM for Rust
https://www.sea-ql.org/SeaORM/
Apache License 2.0
7k stars 488 forks source link

Bug on generating new migration #1303

Closed viralkachhadiya closed 1 year ago

viralkachhadiya commented 1 year ago

Generating new migration... Creating migration file ./src/m20221214_141000_abha_table.rs Adding migration m20221214_141000_abha_table to ./src/lib.rs thread 'main' panicked at 'called Option::unwrap() on a None value', /Users/viral/.cargo/registry/src/github.com-1ecc6299db9ec823/sea-orm-cli-0.10.5/src/commands/migrate.rs:215:20 stack backtrace: 0: rust_begin_unwind at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:584:5 1: core::panicking::panic_fmt at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:142:14 2: core::panicking::panic at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:48:5 3: sea_orm_cli::commands::migrate::run_migrate_generate 4: sea_orm_cli::commands::migrate::run_migrate_command 5: <core::future::from_generator::GenFuture as core::future::future::Future>::poll 6: std::thread::local::LocalKey::with 7: <core::future::from_generator::GenFuture as core::future::future::Future>::poll 8: async_io::driver::block_on 9: async_global_executor::reactor::block_on 10: async_global_executor::executor::block_on 11: std::thread::local::LocalKey::with 12: std::thread::local::LocalKey::with 13: async_std::task::builder::Builder::blocking 14: sea_orm_cli::main

billy1624 commented 1 year ago

Hey @viralkachhadiya, welcome! Thanks for the report!!

Would you mind telling me the file structure of your migration crate? There should be a mod.rs file at the same folder where all migration files are located. Just like https://github.com/SeaQL/sea-orm/tree/master/sea-orm-migration/tests/migrator.

From the error message, I guess the CLI fail to find the mod ... lines in that file.

https://github.com/SeaQL/sea-orm/blob/5b9c49a9a0aaaf643b87090bf8615715d9bc20f0/sea-orm-migration/tests/migrator/mod.rs#L1-L22

viralkachhadiya commented 1 year ago

yes, it's an issue with the migration repository path. I resolved it.

billy1624 commented 1 year ago

Thanks for the updates :)