How do I put MySQL code in the original control?
3 answers
Based on Michal's answer, the solution I have been using so far is:
#!/bin/bash
BACKUP_PATH=/root/database_name
DATABASE=database_name
PASSWORD=Password
rm -f "$BACKUP_PATH/*.sql"
mysqldump -p$PASSWORD --routines --skip-dump-date --no-create-info --no-data --skip-opt $DATABASE > $BACKUP_PATH/$DATABASE.sql
mysqldump -p$PASSWORD --tab=$BACKUP_PATH --skip-dump-date --no-data --skip-opt $DATABASE
hg commit -Am "automatic commit" $BACKUP_PATH
+3
a source to share
You can create triggers when data changes, which would automatically save the change to a control source. However, there is no automatic way to track structure changes (tables, stored procedures, etc.) this way. Therefore, probably the best way is to dump the database and keep these dumps in source control. You can do this periodically to automate things.
+4
a source to share