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

Throw exception if createMissingTablesAndColumns fails (or log warning) #800

Open
Aditya94A opened this issue Feb 15, 2020 · 1 comment
Open

Comments

@Aditya94A
Copy link

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)
@chrisjenx
Copy link

I noticed this today, I think it was after I change the reference behaviour. this should really fail when trying to connect instead of being quiet!

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

No branches or pull requests

3 participants