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

Query to check for index existence #115

Merged
merged 7 commits into from
Sep 6, 2023
Merged

Query to check for index existence #115

merged 7 commits into from
Sep 6, 2023

Conversation

IgnisDa
Copy link
Contributor

@IgnisDa IgnisDa commented Aug 26, 2023

This will allow me to implement the required methods for SeaQL/sea-orm#1827.

{
Query::select()
.expr_as(Expr::cust("COUNT(*) > 0"), Alias::new("has_index"))
.from((Alias::new("information_schema"), Alias::new("statistics")))
Copy link
Member

@tyt2y3 tyt2y3 Aug 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g.

use InformationSchema as Schema;
.from((Schema::Schema, Schema::Statistics))

pub enum InformationSchema {

Copy link
Member

@tyt2y3 tyt2y3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution.
I think the original probe.rs really had set a bad example.
Can you reuse the existing enums where possible, instead of using Alias::new?

@IgnisDa
Copy link
Contributor Author

IgnisDa commented Aug 31, 2023

Thank you for your contribution. I think the original probe.rs really had set a bad example. Can you reuse the existing enums where possible, instead of using Alias::new?

Yeah can do. What else needs to be replaced? And should I change the existing code as well?

tyt2y3 added a commit that referenced this pull request Aug 31, 2023
@tyt2y3
Copy link
Member

tyt2y3 commented Aug 31, 2023

I have refactored the existing code already )

@IgnisDa
Copy link
Contributor Author

IgnisDa commented Sep 2, 2023

@tyt2y3 This is ready to be reviewed.

@IgnisDa IgnisDa requested a review from tyt2y3 September 2, 2023 13:57
@IgnisDa
Copy link
Contributor Author

IgnisDa commented Sep 2, 2023

Tested by running:

# sea-orm-migration/Cargo.toml
[patch.crates-io]
sea-schema = { path = "../../sea-schema" }
DATABASE_URL='sqlite::memory:' cargo test --manifest-path sea-orm-migration/Cargo.toml --test '*' --features sqlx-sqlite,runtime-async-std-rustls

DATABASE_URL='postgres://postgres:password@ipaddress:8000' cargo test --manifest-path sea-orm-migration/Cargo.toml --test '*' --features sqlx-postgres,runtime-async-std-rustls

DATABASE_URL='mysql://mysql:password@ipaddress:8000' cargo test --manifest-path sea-orm-migration/Cargo.toml --test '*' --features sqlx-mysql,runtime-async-std-rustls

Copy link
Member

@tyt2y3 tyt2y3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@tyt2y3 tyt2y3 merged commit c2a3e38 into SeaQL:master Sep 6, 2023
@IgnisDa IgnisDa deleted the has-index branch September 6, 2023 13:15
@IgnisDa
Copy link
Contributor Author

IgnisDa commented Sep 6, 2023

@tyt2y3 When will this be released? Since SeaQL/sea-orm#1828 depends on this.

@tyt2y3
Copy link
Member

tyt2y3 commented Sep 6, 2023

I will probably make a minor release this week. Meanwhile you can override the dependency to using git, pointing to this repo.

@tyt2y3
Copy link
Member

tyt2y3 commented Sep 12, 2023

Would you mind if we wait for the release to include the has_constraint as well?

@IgnisDa
Copy link
Contributor Author

IgnisDa commented Sep 12, 2023

No I think it would be better if it was separate. @tyt2y3

@github-actions
Copy link

🎉 Released In 0.14.1 🎉

Thank you everyone for the contribution!
This feature is now available in the latest release. Now is a good time to upgrade!
Your participation is what makes us unique; your adoption is what drives us forward.
You can support SeaQL 🌊 by starring our repos, sharing our libraries and becoming a sponsor ⭐.

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 this pull request may close these issues.

2 participants