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

Foreign & Indexes support #950

Open
viktorhrekh opened this issue Apr 6, 2023 · 4 comments
Open

Foreign & Indexes support #950

viktorhrekh opened this issue Apr 6, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request type: query

Comments

@viktorhrekh
Copy link

Use case

https://dev.mysql.com/doc/refman/8.0/en/mysql-indexes.html
https://dev.mysql.com/doc/refman/8.0/en/create-table-foreign-keys.html

Describe the solution you'd like

Annotations like @KomapperIndex and @KomapperKey.

@viktorhrekh viktorhrekh added the waiting-for-triage An issue we've not yet triaged label Apr 6, 2023
@nakamura-to
Copy link
Member

Hi,

The syntax of the commands that create indexes and foreign keys is very flexible and unsuitable to be expressed in annotations.

To create indexes and foreign keys, please use the executeScript function:

val query = QueryDsl.executeScript("CREATE INDEX part_of_name ON customer (name(10));")
db.runQuery(query)

@nakamura-to nakamura-to added enhancement New feature or request type: query and removed waiting-for-triage An issue we've not yet triaged labels Apr 6, 2023
@dave08
Copy link

dave08 commented Apr 23, 2023

Doesn't have to be annotations... (although it would be nice...), it could be some kind of DdlDsl or maybe a builder on the createSchema (which would make creation of a table in one statement, which could be nicer...).

Otherwise, we loose some of the beauty of Komapper's support for multiple dbs... we can't use the same code to create the indexes between dbs (like for a production/staging or testing db -- testing dbs by us are in H2 for speed unless specific db features are needed...)

@nakamura-to
Copy link
Member

I believe that the development environment should use the same type of database as the production environment.
Testcontainers doesn't meet your needs? Is it too slow for you?

@dave08
Copy link

dave08 commented Apr 24, 2023

I use Testcontainers before a release... but while doing TDD it's too slow. H2 is sufficient for TDD and before a release, running with a real db just to make sure.

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

No branches or pull requests

3 participants