As seen in #7136 we have no tests or checks to ensure that the backend code that defines the database table structures is the same as the actual database tables in the database.
It also has been seen in other issues such as #5497, #1517
This could lead to some pretty bad situations if the backend tries to write using the wrong type or to non existing columns. Ideally we would at least have tests that ensure the backend table definitions are correct.
I tried to do this is in #7138 but it is not trivial because exposed does not have functions that convert existing tables into exposed table structures. Although it has code that can apply a migration exposed cannot properly reconcile postgres types (see https://www.jetbrains.com/help/exposed/migrations.html) and only catches the case where types in Exposed are narrower than DB (where actually the reverse would be more dangerous).
The paid jetbrains exposed plugin actually offers codegen (turning sql table definitions into exposed code) but this isnt sadly available.
As seen in #7136 we have no tests or checks to ensure that the backend code that defines the database table structures is the same as the actual database tables in the database.
It also has been seen in other issues such as #5497, #1517
This could lead to some pretty bad situations if the backend tries to write using the wrong type or to non existing columns. Ideally we would at least have tests that ensure the backend table definitions are correct.
I tried to do this is in #7138 but it is not trivial because exposed does not have functions that convert existing tables into exposed table structures. Although it has code that can apply a migration exposed cannot properly reconcile postgres types (see https://www.jetbrains.com/help/exposed/migrations.html) and only catches the case where types in Exposed are narrower than DB (where actually the reverse would be more dangerous).
The paid jetbrains exposed plugin actually offers codegen (turning sql table definitions into exposed code) but this isnt sadly available.