1
|
#!/bin/bash -e
|
2
|
# syncs VegCore.ERD.mwb's zip file contents
|
3
|
. "$(dirname "${BASH_SOURCE[0]}")"/../../../lib/runscripts/util.run
|
4
|
.rel ../../../lib/sh/archives.sh
|
5
|
.rel ../../../lib/sh/local.sh
|
6
|
.rel ../../../lib/sh/make.sh
|
7
|
|
8
|
if self_not_included; then
|
9
|
|
10
|
# to edit VegCore.ERD.mwb, you *must* use the Linux version of MySQL Workbench.
|
11
|
# the Mac version does not export the PDFs correctly: in the single-page PDF,
|
12
|
# the lines take very long to load; and in the printed PDF, the colors are wrong
|
13
|
# in Adobe Reader.
|
14
|
#
|
15
|
# unfortunately, you cannot switch back and forth between the two versions,
|
16
|
# because they render the lines with a different spacing, which makes the tables
|
17
|
# different sizes and misaligns the connector lines.
|
18
|
# it is especially unfortunate that the Mac version messes up the PDFs, because
|
19
|
# it uses a smaller line spacing and therefore smaller tables, which allows the
|
20
|
# tables to be spaced farther apart for better readability.
|
21
|
|
22
|
# note that schema COMMENTs cannot contain ' (used in contractions such as
|
23
|
# "don't"), because MySQL Workbench cannot escape these properly
|
24
|
|
25
|
../VegCore.my.sql/make()
|
26
|
{
|
27
|
echo_func; set_make_vars
|
28
|
database=VegCore create_db=1 mysqldump_local --skip-add-drop-table \
|
29
|
>"$target"
|
30
|
}
|
31
|
|
32
|
export_mysql()
|
33
|
{
|
34
|
echo_func
|
35
|
../VegCore.my.sql/make
|
36
|
}
|
37
|
|
38
|
../VegCore.pg.sql/make()
|
39
|
{
|
40
|
echo_func; set_make_vars
|
41
|
sql_ascii=1 my2pg <"${target%.pg.sql}.my.sql" >"$target"
|
42
|
}
|
43
|
|
44
|
export_postgres()
|
45
|
{
|
46
|
echo_func
|
47
|
../VegCore.pg.sql/make
|
48
|
}
|
49
|
|
50
|
export_()
|
51
|
{
|
52
|
echo_func
|
53
|
(cd "$top_dir"; unzip_newer "$top_filename" document.mwb.xml)
|
54
|
export_mysql
|
55
|
export_postgres
|
56
|
}
|
57
|
|
58
|
import()
|
59
|
{
|
60
|
echo_func
|
61
|
(cd "$top_dir"; zip_newer "$top_filename" document.mwb.xml)
|
62
|
}
|
63
|
|
64
|
sync()
|
65
|
{
|
66
|
echo_func
|
67
|
export_
|
68
|
import
|
69
|
}
|
70
|
|
71
|
all()
|
72
|
{
|
73
|
echo_func
|
74
|
sync
|
75
|
}
|
76
|
|
77
|
fi
|