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

#[sea_orm(indexed)] only works for MySQL #554

Closed
grtlr opened this issue Feb 23, 2022 · 3 comments · Fixed by #593
Closed

#[sea_orm(indexed)] only works for MySQL #554

grtlr opened this issue Feb 23, 2022 · 3 comments · Fixed by #593

Comments

@grtlr
Copy link

grtlr commented Feb 23, 2022

Description

Using the #[sea_orm(indexed)] property only works for the MySQL backend and crashes when using sqlite.

Steps to Reproduce

Put the #[sea_orm(indexed)] property on any field of a struct that derives DeriveEntityModel while using a sqlite backend.

Expected Behavior

Ideally it would create the index, but at least it shouldn't crash, emitting an error at compile time.

Actual Behavior

It crashes.

Reproduces How Often

Everytime 😉.

Versions

I'm running sea-orm v0.6.0.

Additional Information

It might be helpful to emphasize this in the appropriate sections of the documentation.

@nickb937
Copy link
Contributor

I'd opened a similar issue, incorrectly against sea-query, too : SeaQL/sea-query#232

@billy1624
Copy link
Member

Thanks!! @grtlr

It might be helpful to emphasize this in the appropriate sections of the documentation.

As discussed on Discord the first thing I would do was this.

@tyt2y3
Copy link
Member

tyt2y3 commented Mar 15, 2022

We should separate the logic from create_table_from_entity and extract to a new function create_index_from_entity

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

Successfully merging a pull request may close this issue.

4 participants