JetBrains / JetBrains/Exposed

Throw exception if createMissingTablesAndColumns fails (or log warning)

Open
#800 1 comment 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
9.3k
Forks
798
Avg merge
4d 2h
Merged PRs (30d)
26

Description

Right now `createMissingTablesAndColumns` silently fails if it's unable to do some column/table change.

In order to make this library more useful in mature production flows with database migrations, IMO exposed should do it's best to warn against potential inconsistencies in the database when compared to the exposed table definitions.

For e.g: If `createMissingTablesAndColumns` fails, then the server will crash at runtime. This is clearly unwanted behavior.

Here are some ideas:
* Show detailed INFO logs about what columns were changed and how
* Log a WARN when exposed fails to make a change
* Have some sort of sanity check (e.g `SchemaUtils.checkCRUDfor(Table1, Table2)`), so that we can be sure that at least CRUD operations on table rows are happening correctly, further strengthening confidence that some small column change wasn't missed somewhere, and we'd only find out in production.
* Maintain some sort of schema database/table (like exposed's internal representation of database states that can be used to compare against when exposed is run again with conflicting table/column definitions => This would be a good prompt for the developer that they probably missed migrating something)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.