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
When running the command cargo loco generate model, migrations are automatically applied. However, the command output still prompts the user to apply the migration. This behavior is inconsistent. The command should not apply migrations automatically. If it does, then the output should not ask the user to apply the migration again.
To Reproduce
loco new
then select option Rest API (with DB and user auth) cd myapp cargo loco generate model article title:string content:text
Expected Behavior
The command should not apply migrations automatically. If it does, then the output should not ask the user to apply the migration again.
Environment:
Additional Context
Here is output of command
cargo loco generate model article title:string content:text
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.66s
Running `target/debug/myapp-cli generate model article 'title:string' 'content:text'`
added: "migration/src/m20250310_090113_articles.rs"
injected: "migration/src/lib.rs"
injected: "migration/src/lib.rs"
added: "tests/models/articles.rs"
injected: "tests/models/mod.rs"
Compiling ring v0.17.13
Compiling rustls v0.23.23
Compiling rustls-webpki v0.102.8
Compiling jsonwebtoken v9.3.1
Compiling sqlx-core v0.8.3
Compiling tokio-rustls v0.26.2
Compiling hyper-rustls v0.27.5
Compiling lettre v0.11.14
Compiling reqwest v0.12.12
Compiling opendal v0.50.2
Compiling sqlx-mysql v0.8.3
Compiling sqlx-sqlite v0.8.3
Compiling sqlx-postgres v0.8.3
Compiling sqlx v0.8.3
Compiling sea-query-binder v0.7.0
Compiling sea-orm v1.1.7
Compiling sea-orm-migration v1.1.7
Compiling loco-rs v0.14.1
Compiling migration v0.1.0 (/Users/alok/tmp/test-rust/myapp/migration)
Compiling myapp v0.1.0 (/Users/alok/tmp/test-rust/myapp)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 23.64s
Running `target/debug/myapp-cli db migrate`
2025-03-10T09:01:37.837332Z WARN app: loco_rs::boot: pretty backtraces are enabled (this is great for development but has a runtime cost for production. disable with `logger.pretty_backtrace` in your config yaml) environment=development
2025-03-10T09:01:37.868054Z WARN app: loco_rs::boot: migrate: environment=development
2025-03-10T09:01:37.876313Z INFO app: sea_orm_migration::migrator: Applying all pending migrations environment=development
2025-03-10T09:01:37.882400Z INFO app: sea_orm_migration::migrator: Applying migration 'm20250310_090113_articles' environment=development
2025-03-10T09:01:37.968161Z INFO app: sea_orm_migration::migrator: Migration 'm20250310_090113_articles' has been applied environment=development
Blocking waiting for file lock on build directory
Compiling ring v0.17.13
Compiling rustls v0.23.23
Compiling rustls-webpki v0.102.8
Compiling jsonwebtoken v9.3.1
Compiling sqlx-core v0.8.3
Compiling tokio-rustls v0.26.2
Compiling hyper-rustls v0.27.5
Compiling lettre v0.11.14
Compiling reqwest v0.12.12
Compiling opendal v0.50.2
Compiling sqlx-postgres v0.8.3
Compiling sqlx-sqlite v0.8.3
Compiling sqlx-mysql v0.8.3
Compiling sqlx v0.8.3
Compiling sea-query-binder v0.7.0
Compiling sea-orm v1.1.7
Compiling sea-orm-migration v1.1.7
Compiling loco-rs v0.14.1
Compiling migration v0.1.0 (/Users/alok/tmp/test-rust/myapp/migration)
Compiling myapp v0.1.0 (/Users/alok/tmp/test-rust/myapp)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 35.61s
Running `target/debug/myapp-cli db entities`
2025-03-10T09:02:14.769086Z WARN app: loco_rs::boot: pretty backtraces are enabled (this is great for development but has a runtime cost for production. disable with `logger.pretty_backtrace` in your config yaml) environment=development
2025-03-10T09:02:14.795544Z WARN app: loco_rs::boot: entities: environment=development
Connecting to MySQL ...
Discovering schema ...
... discovered.
Generating articles.rs
> Column `created_at`: DateTimeUtc, not_null
> Column `updated_at`: DateTimeUtc, not_null
> Column `id`: i32, auto_increment, not_null
> Column `title`: Option<String>
> Column `content`: Option<String>
Generating posts.rs
> Column `created_at`: DateTimeUtc, not_null
> Column `updated_at`: DateTimeUtc, not_null
> Column `id`: i32, auto_increment, not_null
> Column `title`: Option<String>
> Column `content`: Option<String>
Generating users.rs
> Column `created_at`: DateTimeUtc, not_null
> Column `updated_at`: DateTimeUtc, not_null
> Column `id`: i32, auto_increment, not_null
> Column `pid`: Vec<u8>, not_null
> Column `email`: String, not_null, unique
> Column `password`: String, not_null
> Column `api_key`: String, not_null, unique
> Column `name`: String, not_null
> Column `reset_token`: Option<String>
> Column `reset_sent_at`: Option<DateTimeUtc>
> Column `email_verification_token`: Option<String>
> Column `email_verification_sent_at`: Option<DateTimeUtc>
> Column `email_verified_at`: Option<DateTimeUtc>
> Column `magic_link_token`: Option<String>
> Column `magic_link_expiration`: Option<DateTimeUtc>
Writing src/models/_entities/articles.rs
Writing src/models/_entities/posts.rs
Writing src/models/_entities/users.rs
Writing src/models/_entities/mod.rs
Writing src/models/_entities/prelude.rs
... Done.
2025-03-10T09:02:15.321012Z WARN app: loco_rs::boot: environment=development
* Migration for `article` added! You can now apply it with `$ cargo loco db migrate`.
* A test for model `Articles` was added. Run with `cargo test`.
The text was updated successfully, but these errors were encountered:
Description
When running the command
cargo loco generate model
, migrations are automatically applied. However, the command output still prompts the user to apply the migration. This behavior is inconsistent. The command should not apply migrations automatically. If it does, then the output should not ask the user to apply the migration again.To Reproduce
loco new
then select option Rest API (with DB and user auth)
cd myapp
cargo loco generate model article title:string content:text
Expected Behavior
The command should not apply migrations automatically. If it does, then the output should not ask the user to apply the migration again.
Environment:
Additional Context
Here is output of command
The text was updated successfully, but these errors were encountered: