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 \
28 profile_networking_enum \
29 profile_section_enum \
39 Will dump the necessary data from MySQL.
40 Note that all options should have sane defaults if you have correctly configured
45 -H HOST MySQL host to connect to (default: none)
46 -P PORT MySQL port to connect to (default: none)
47 -u USER User for MySQL (default: none)
48 -p PASS MySQL password to use (default: none)
49 -d SQL_DB Database to read from (default: x5dat)
50 -n Dry run, don't actually write anything
51 -o FILE Write to file instead of stdout (- for stdout as well)
64 while getopts "hns:u:p:o:" OPTION
99 FILTER
="sed -r s/AUTO_INCREMENT=[1-9]+/AUTO_INCREMENT=1/"
100 DUMPER
="mysqldump --add-drop-table --default-character-set=utf8 --force"
102 if [ -n
"$USER" ]; then
103 DUMPER
="$DUMPER --user=$USER"
106 if [ -n
"$PASS" ]; then
107 DUMPER
="$DUMPER --password=$PASS"
110 if [ -n
"$HOST" ]; then
111 DUMPER
="$DUMPER --host=$HOST"
114 if [ -n
"$PORT" ]; then
115 DUMPER
="$DUMPER --port=$PORT"
118 if [ "$FILE" == "-" ]; then
121 if [ $DRY_RUN -ne
1 ]; then
130 if [ $DRY_RUN -eq
1 ]; then
131 if [ -n
"$FILE" ]; then
132 echo "$command | $FILTER >> $FILE"
134 echo "$command | $FILTER"
137 if [ -n
"$FILE" ]; then
138 $command |
$FILTER >> $FILE
146 STRUCT_DUMPER
="$DUMPER --no-data $SQL_DB"
147 dump
"$STRUCT_DUMPER"
149 SHARED_DUMPER
="$DUMPER $SQL_DB $SHARED_TABLES"
150 dump
"$SHARED_DUMPER"