Update DB dump to newest version
Closed this issue · 4 comments
While investigating serlo/database-layer#451 I have found out that with the anonymized dump the metadata query is quite fast on my laptop (2-3s) while it takes 20-30s with the current local version of the DB in this repository. Before we investigate the reason for this: How about that we update https://github.com/serlo/database-layer/blob/main/mysql/docker-entrypoint-initdb.d/001-init.sql to a more recent version? How to do it:
- Import anonymized dump via
yarn mysql:import-anonymous-data
- Fix tests
- Run
yarn mysql:dump
and add the new version of https://github.com/serlo/database-layer/blob/main/mysql/docker-entrypoint-initdb.d/001-init.sql to the commit
I'm just not sure if we should dump the whole staging database (for data protection reasons) or if we should just choose some exemplars of each table.
I wonder if we want a database at all in the repository instead of for example a Docker container with a database for testing.
Fixing the tests can be changing the IDs to other ones so they work again. It could, however, also mean changing the test cases to be standalone (= not needing the database). There is also serlo/database-layer#361 for changing the tests, possibly related.
I wonder if we want a database at all in the repository instead of for example a Docker container with a database for testing.
This is a good idea. See serlo/local-dev-env#14
Fixing the tests can be changing the IDs to other ones so they work again. It could, however, also mean changing the test cases to be standalone (= not needing the database)
Changing to standalone
Pro:
- More readable
- More control
- We don't have to change all tests at each new dump
Contra:
- It is more work than just updating the ids in tests
- It doesn't catch edge cases that could exist in the real database
- We would anyway need a database in order to run
yarn sqlx:prepare
, otherwise we would need to opt it out
So, IMHO we should keep a dummy dump and just update the ids, even though it is a ungrateful work.