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_administrative_areas
13 geoloc_subadministrativeareas
18 profile_corps_rank_enum
19 profile_education_degree_enum
20 profile_education_enum
21 profile_education_field_enum
23 profile_job_entreprise_term
25 profile_job_sector_enum
26 profile_job_subsector_enum
27 profile_job_subsubsector_enum
29 profile_job_term_relation
30 profile_langskills_enum
32 profile_medal_grade_enum
34 profile_networking_enum
45 Will dump the necessary data from MySQL.
46 Note that all options should have sane defaults if you have correctly configured
51 -H HOST MySQL host to connect to (default: none)
52 -P PORT MySQL port to connect to (default: none)
53 -u USER User for MySQL (default: none)
54 -p PASS MySQL password to use (default: none)
55 -d SQL_DB Database to read from (default: x5dat)
56 -n Dry run, don't actually write anything
57 -o FILE Write to file instead of stdout (- for stdout as well)
70 while getopts "hns:u:p:o:" OPTION
106 DUMPER
="mysqldump --add-drop-table --default-character-set=utf8 --force"
108 if [ -n
"$USER" ]; then
109 DUMPER
="$DUMPER --user=$USER"
112 if [ -n
"$PASS" ]; then
113 DUMPER
="$DUMPER --password=$PASS"
116 if [ -n
"$HOST" ]; then
117 DUMPER
="$DUMPER --host=$HOST"
120 if [ -n
"$PORT" ]; then
121 DUMPER
="$DUMPER --port=$PORT"
124 if [ "$FILE" == "-" ]; then
127 if [ $DRY_RUN -ne
1 ]; then
136 if [ $DRY_RUN -eq
1 ]; then
137 if [ -n
"$FILE" ]; then
138 echo "$command >> $FILE"
143 if [ -n
"$FILE" ]; then
152 STRUCT_DUMPER
="$DUMPER --no-data $SQL_DB"
153 dump
"$STRUCT_DUMPER"
155 SHARED_DUMPER
="$DUMPER $SQL_DB $SHARED_TABLES"
156 dump
"$SHARED_DUMPER"