'Solution'#165
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because a core requirement of the task is still missing and this blocks correct completion. Your script correctly creates a full backup of ShopDB and restores it into ShopDBReserve, and it also creates a data-only dump of ShopDB using --no-create-info, which is exactly what is needed for the development database.
However, on task.sh after the line that creates backup-no-create-info.sql (the mysqldump ... --no-create-info ... > backup-no-create-info.sql command), there is no corresponding restore command that imports this dump into ShopDBDevelopment. The task explicitly requires: "Create a data backup from the database ShopDB, and restore it to the database ShopDBDevelopment." Without this import step, ShopDBDevelopment never receives the data and the tests that verify the Products table there will fail. To fix this, add a line such as:
mysql -u "$DB_USER" -p"$DB_PASSWORD" ShopDBDevelopment < backup-no-create-info.sqlOnce that restore step is in place, your solution should satisfy the core functional requirements; the rest of your approach and use of environment variables looks good, and this is a solid base for a backup/restore script.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| mysqldump -u "$DB_USER" -p"$DB_PASSWORD" ShopDB --no-create-db > backup-no-create-db.sql | ||
| mysql -u "$DB_USER" -p"$DB_PASSWORD" ShopDBReserve < backup-no-create-db.sql | ||
|
|
||
| mysqldump -u "$DB_USER" -p"$DB_PASSWORD" ShopDB --no-create-info > backup-no-create-info.sql |
There was a problem hiding this comment.
You correctly create a data-only dump of ShopDB, but the task also requires restoring this data into ShopDBDevelopment. Add a corresponding mysql -u "$DB_USER" -p"$DB_PASSWORD" ShopDBDevelopment < backup-no-create-info.sql command after this line so the development database actually receives the data.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution because the task.sh script cleanly implements all the required backup and restore steps and there are no critical blockers. Your script correctly uses DB_USER and DB_PASSWORD environment variables when calling mysqldump and mysql, which keeps it non-interactive and suitable for cron. You create a full backup of ShopDB (schema + data) and restore it into ShopDBReserve, and you separately create a data-only backup and restore it into ShopDBDevelopment, matching the described production/DR/dev workflow. Functionally, this ensures the Products table will have the same data in ShopDB, ShopDBReserve, and ShopDBDevelopment, assuming the databases and schemas exist as per the task instructions. As possible minor future improvements (not required for this task), you could add basic error checking on the dump and restore commands and maybe some logging so failures are easier to diagnose. Overall, your implementation is straightforward, correct for the requirements, and ready to be used in an automated environment.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.