Add instructions to make a db-dump

This commit is contained in:
ShootingStar91
2024-09-02 21:58:43 +03:00
parent 086ff2ee36
commit eb6f043ccf
+11
View File
@@ -27,6 +27,17 @@ If the database schema is changed, prisma-schema must be also updated. The smart
Prisma documentation: https://www.prisma.io/docs/orm/reference/prisma-cli-reference#db-pull
**Updating test data**
Sometimes you may want to add some test user or entries into the anonymous data in order to test something better. This can be done by `mariadb-dump` program which is included in the `mariadb` official docker image:
* Reset the anonymous data to the initial state: `npm run reset-anon-db`
* Do the necessary edits, either via code, UI, or by executing commands in the mariadb cli.
* Take a dump of the relevant tables: `docker exec nowdb-db-anon mariadb-dump <db_name> -uroot -padmin > ./<db_name>.sql`
+ The db names are probably "now_test" or "now_log_test".
+ Replace the .sql-files in `test_data/sqlfiles/` with the new dump you created.
+ Commit and push the new dump - unless you did this for the staging-data dump, in which case you shouldn't commit and push.
**Mariadb-connector and transactions**
Prisma does not have proper support for connecting to multiple databases, and transactionality between them is therefore impossible. We need transactional write to both now and now_log databases. Therefore we use mariadb-connector for the write operations that need to be logged into the log-database.