Sync local DB with production DB
kulla opened this issue · comments
There seems to be a difference between local and production DB, see https://serlo.slack.com/archives/C04TTH20JP5/p1686553440157629
Target of this issue: Investigate the change and update the local DB so be in sync with production DB
How to do it?
yarn mysql:rollback
-> Make sure the local DB is the one of https://github.com/serlo/database-layer/blob/main/docker-entrypoint-initdb.d/001-init.sqlyarn mysql
-> Make changes to the SQL tablesyarn mysql:dump
-> Save changes of DB in https://github.com/serlo/database-layer/blob/main/docker-entrypoint-initdb.d/001-init.sql- Git commit + PR
heyy! I was to trying to solve this issue but when i tried installing sqlx-cli it failed with error
error: failed to compile sqlx-cli v0.6.3
, intermediate artifacts can be found at /tmp/cargo-installOCgsQp
I have installed rust and docker and also have cargo on my local machine is there anything else I can do to solve this issue
Hi @tiwariParth
Thanks for your motivation to solve this issue!
Since we actually don't really know what changes have to be made in the sql tables, I would recommend you to start with another issue: could you try to tackle #343 ?
Regarding your compile issue we can't know, have taken a look at stackoverflow or at the sqlx-cli repo?
error: failed to compile sqlx-cli v0.6.3, intermediate artifacts can be found at /tmp/cargo-installOCgsQp
Maybe you can send us more information (like logs of the build, e.g. in /tmp/cargo-installOCgsQp
)
For documentation, the MySQL commands for this task were:
mysql> describe notification;
+------------+------------+------+-----+-------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------+------+-----+-------------------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| user_id | bigint(20) | NO | MUL | NULL | |
| seen | tinyint(1) | NO | | 0 | |
| date | timestamp | NO | | CURRENT_TIMESTAMP | |
| email | tinyint(1) | YES | | 0 | |
| email_sent | tinyint(1) | YES | | 0 | |
+------------+------------+------+-----+-------------------+----------------+
mysql> ALTER TABLE notification MODIFY email TINYINT(1) NOT NULL DEFAULT '0', MODIFY email_sent TINYINT(1) NOT NULL DEFAULT '0';
Query OK, 0 rows affected (0.08 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> describe notification;
+------------+------------+------+-----+-------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------+------+-----+-------------------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| user_id | bigint(20) | NO | MUL | NULL | |
| seen | tinyint(1) | NO | | 0 | |
| date | timestamp | NO | | CURRENT_TIMESTAMP | |
| email | tinyint(1) | NO | | 0 | |
| email_sent | tinyint(1) | NO | | 0 | |
+------------+------------+------+-----+-------------------+----------------+
6 rows in set (0.00 sec)