ufoss-org / kotysa

The idiomatic way to write type-safe SQL in Kotlin
The Unlicense
118 stars 1 forks source link

Add support for custom queries #132

Open fsalem opened 1 year ago

fsalem commented 1 year ago

The current version of Kotysa does not support altering a table or writing custom queries. For migration proposes, it could be essential to adding, removing, or updating columns without removing the the whole table and recreate it again.

pull-vert commented 1 year ago

Hi @fsalem This is perfectly exact ! Initially I provided very basic ability to create and delete tables in Kotysa for testing purpose, to populate a test database for example, based on your entities.

I don't think an ORM should provide a full migration database support, this is another type of tooling, that instead of an ORM cannot rely on the entities (that can have a new column, or had a column removed). The production database modeling and migration must support fine-tuning, optimizations, encoding, checksum verification for migration scripts etc. The JVM already have great tools for this specific need : Liquibase, Flyway and others. For now I advise to use these tools for database migration, and Kotysa for the queries.

I add the "help wanted" label, so if someone has the motivation to code this feature, a PR would be welcome !