GEWIS / sudosos-backend

SudoSOS is a Node.js-based Bar and POS system made for study association GEWIS.
https://sudosos.gewis.nl
GNU Affero General Public License v3.0
6 stars 3 forks source link

Improved migration and integration testing #176

Closed JustSamuel closed 3 months ago

JustSamuel commented 5 months ago

So, as I made a mistake in my database migration (#175) I propose a better flow.

For each migration we should create a test case as follows:

Of course this only works on MySQL as you need a persistent DB schema across the test cases. We already have a test similar to that, but we use our own up and down defined migrations which means that the precondition of having the database as it was before we changed the database is not met.

This should find those mistakes

Note: why don't we just always use the automigrate? I encourage you to check out the ungodly and unmanage sql that TypeORM spits out. I think we are better of writing our own, sensible, migrations.

JustSamuel commented 3 months ago

Going to close this since the automigration rollback wouldn't really work since they also hardcode all the keys and relations. This makes creating a function rollback quite difficult. My suggestion would just be good testing? Keep it running on develop for some time, that worked.

Better yet, try and prevent migrations.