3 # This script is used to export the MySQL structure of the plat/al MySQL
7 # Developers: list 'public' tables here.
8 SHARED_TABLES
="account_types \
16 profile_corps_rank_enum \
17 profile_education_degree \
18 profile_education_degree_enum \
19 profile_education_enum \
20 profile_education_field_enum \
21 profile_job_entreprise_term \
23 profile_job_term_enum \
24 profile_job_term_relation \
25 profile_langskill_enum \
27 profile_medal_grade_enum \
29 profile_networking_enum \
30 profile_section_enum \
40 Will dump the necessary data from MySQL.
41 Note that all options should have sane defaults if you have correctly configured
46 -H HOST MySQL host to connect to (default: none)
47 -P PORT MySQL port to connect to (default: none)
48 -u USER User for MySQL (default: none)
49 -p PASS MySQL password to use (default: none)
50 -d SQL_DB Database to read from (default: x5dat)
51 -n Dry run, don't actually write anything
52 -o FILE Write to file instead of stdout (- for stdout as well)
65 while getopts "hns:u:p:o:" OPTION
100 FILTER
="sed -r s/AUTO_INCREMENT=[1-9]+/AUTO_INCREMENT=1/"
101 DUMPER
="mysqldump --add-drop-table --default-character-set=utf8 --force"
103 if [ -n
"$USER" ]; then
104 DUMPER
="$DUMPER --user=$USER"
107 if [ -n
"$PASS" ]; then
108 DUMPER
="$DUMPER --password=$PASS"
111 if [ -n
"$HOST" ]; then
112 DUMPER
="$DUMPER --host=$HOST"
115 if [ -n
"$PORT" ]; then
116 DUMPER
="$DUMPER --port=$PORT"
119 if [ "$FILE" == "-" ]; then
122 if [ $DRY_RUN -ne
1 ]; then
131 if [ $DRY_RUN -eq
1 ]; then
132 if [ -n
"$FILE" ]; then
133 echo "$command | $FILTER >> $FILE"
135 echo "$command | $FILTER"
138 if [ -n
"$FILE" ]; then
139 $command |
$FILTER >> $FILE
147 STRUCT_DUMPER
="$DUMPER --no-data $SQL_DB"
148 dump
"$STRUCT_DUMPER"
150 SHARED_DUMPER
="$DUMPER $SQL_DB $SHARED_TABLES"
151 dump
"$SHARED_DUMPER"