Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Contributing to mention backup information #1569

Merged
merged 6 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
env_file:
- .env
environment:
- MYSQL_ROOT_HOST="0.0.0.0"
- MYSQL_ROOT_HOST=%
ports:
- "5306:3306"
volumes:
Expand Down
18 changes: 17 additions & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,24 @@ docker exec -it student_dashboard_mysql mysql_upgrade \
When prompted, specify the password for the root MySQL user.
It should be found in the `MYSQL.ROOT_PASSWORD` property of `env.hjson`.

[Next: Contributors](../docs/CONTRIBUTORS.md)
### Backing up the development database

To backup the development databaes with the default settings, use this command
```sh
docker exec student_dashboard_mysql mysqldump --socket=/tmp/mysql.sock -uroot -pstudent_dashboard_root_pw student_dashboard > student_dashboard.sql
zqian marked this conversation as resolved.
Show resolved Hide resolved
```

To restore this database to a new database you had created as an admin called student_dashboard_new (CREATE database student_dashboard_new). You can also just restore it to the same database (student_dashboard).

```sh
docker exec -i student_dashboard_mysql mysql -uroot -pstudent_dashboard_root_pw student_dashboard_new < student_dashboard.sql`
jonespm marked this conversation as resolved.
Show resolved Hide resolved
jonespm marked this conversation as resolved.
Show resolved Hide resolved
```

Note: It's possible you may need to recreate the database (delete the .data directory) if your value in docker-compose was `MYSQL_ROOT_HOST="0.0.0.0"` which makes it difficult to connect to MySQL.

### Dependency Upgrade

For Auto-upgrade django to future version, use the helpful library called [django-upgrade](https://github.com/adamchainz/django-upgrade )

[Next: Contributors](../docs/CONTRIBUTORS.md)