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 \
10 geoloc_administrativeareas \
13 geoloc_subadministrativeareas \
18 profile_corps_rank_enum \
19 profile_education_degree \
20 profile_education_degree_enum \
21 profile_education_enum \
22 profile_education_field_enum \
23 profile_job_entreprise_term \
25 profile_job_term_enum \
26 profile_job_term_relation \
27 profile_langskill_enum \
29 profile_medal_grade_enum \
31 profile_networking_enum \
32 profile_section_enum \
42 Will dump the necessary data from MySQL.
43 Note that all options should have sane defaults if you have correctly configured
48 -H HOST MySQL host to connect to (default: none)
49 -P PORT MySQL port to connect to (default: none)
50 -u USER User for MySQL (default: none)
51 -p PASS MySQL password to use (default: none)
52 -d SQL_DB Database to read from (default: x5dat)
53 -n Dry run, don't actually write anything
54 -o FILE Write to file instead of stdout (- for stdout as well)
67 while getopts "hns:u:p:o:" OPTION
102 FILTER
="sed -r s/AUTO_INCREMENT=[1-9]+/AUTO_INCREMENT=1/"
103 DUMPER
="mysqldump --add-drop-table --default-character-set=utf8 --force"
105 if [ -n
"$USER" ]; then
106 DUMPER
="$DUMPER --user=$USER"
109 if [ -n
"$PASS" ]; then
110 DUMPER
="$DUMPER --password=$PASS"
113 if [ -n
"$HOST" ]; then
114 DUMPER
="$DUMPER --host=$HOST"
117 if [ -n
"$PORT" ]; then
118 DUMPER
="$DUMPER --port=$PORT"
121 if [ "$FILE" == "-" ]; then
124 if [ $DRY_RUN -ne
1 ]; then
133 if [ $DRY_RUN -eq
1 ]; then
134 if [ -n
"$FILE" ]; then
135 echo "$command | $FILTER >> $FILE"
137 echo "$command | $FILTER"
140 if [ -n
"$FILE" ]; then
141 $command |
$FILTER >> $FILE
149 STRUCT_DUMPER
="$DUMPER --no-data $SQL_DB"
150 dump
"$STRUCT_DUMPER"
152 SHARED_DUMPER
="$DUMPER $SQL_DB $SHARED_TABLES"
153 dump
"$SHARED_DUMPER"