ac2d9b769ba792095c969111d919dcb3f7090e52
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 \
30 profile_networking_enum \
31 profile_section_enum \
41 Will dump the necessary data from MySQL.
42 Note that all options should have sane defaults if you have correctly configured
47 -H HOST MySQL host to connect to (default: none)
48 -P PORT MySQL port to connect to (default: none)
49 -u USER User for MySQL (default: none)
50 -p PASS MySQL password to use (default: none)
51 -d SQL_DB Database to read from (default: x5dat)
52 -n Dry run, don't actually write anything
53 -o FILE Write to file instead of stdout (- for stdout as well)
66 while getopts "hns:u:p:o:" OPTION
101 FILTER
="sed -r s/AUTO_INCREMENT=[1-9]+/AUTO_INCREMENT=1/"
102 DUMPER
="mysqldump --add-drop-table --default-character-set=utf8 --force"
104 if [ -n
"$USER" ]; then
105 DUMPER
="$DUMPER --user=$USER"
108 if [ -n
"$PASS" ]; then
109 DUMPER
="$DUMPER --password=$PASS"
112 if [ -n
"$HOST" ]; then
113 DUMPER
="$DUMPER --host=$HOST"
116 if [ -n
"$PORT" ]; then
117 DUMPER
="$DUMPER --port=$PORT"
120 if [ "$FILE" == "-" ]; then
123 if [ $DRY_RUN -ne
1 ]; then
132 if [ $DRY_RUN -eq
1 ]; then
133 if [ -n
"$FILE" ]; then
134 echo "$command | $FILTER >> $FILE"
136 echo "$command | $FILTER"
139 if [ -n
"$FILE" ]; then
140 $command |
$FILTER >> $FILE
148 STRUCT_DUMPER
="$DUMPER --no-data $SQL_DB"
149 dump
"$STRUCT_DUMPER"
151 SHARED_DUMPER
="$DUMPER $SQL_DB $SHARED_TABLES"
152 dump
"$SHARED_DUMPER"