Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SeaORM's --model-extra-derives in db entities command #1210

Open
its-grape-juice opened this issue Jan 23, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@its-grape-juice
Copy link

Feature Request

Is your feature request related to a problem? Please describe.

Currently unable to add custom derives like clickhouse::Row to generated database entities in Loco because the --model-extra-derives option from SeaORM's CLI is not exposed through Loco's db entities command.

Describe the solution you'd like

Add support for SeaORM's --model-extra-derives option in Loco's db entities command. This would allow users to specify additional derive macros for the generated model structs. For example:

loco db entities --model-extra-derives "clickhouse::Row"

Describe alternatives you've considered

Manually adding derives to generated files (not maintainable, gets overwritten on regeneration)

@its-grape-juice its-grape-juice added the enhancement New feature or request label Jan 23, 2025
@wdcodecn
Copy link

Image

@wdcodecn
Copy link

in my usecase


cargo loco db entities

sea-orm-cli generate entity --with-serde both --model-extra-derives 'sea_orm_crud_macros::SeaOrmCrud' --output-dir src/models/_entities --database-url postgres://postgres:1234qwer@localhost:5432/loco

sed -i 's/impl ActiveModelBehavior for ActiveModel {}/\/\/impl ActiveModelBehavior for ActiveModel {}/g' src/models/_entities/*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants