Project

General

Profile

1 8654 aaronmk
#!/bin/bash -e
2
# syncs VegCore.ERD.mwb's zip file contents
3 11041 aaronmk
. "$(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 8654 aaronmk
8 8705 aaronmk
if self_not_included; then
9
10 10654 aaronmk
# to edit VegCore.ERD.mwb, you *must* use the Linux version of MySQL Workbench.
11 10655 aaronmk
# 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 10654 aaronmk
#
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 11196 aaronmk
# note that schema COMMENTs cannot contain ' (used in contractions such as
23
# "don't"), because MySQL Workbench cannot escape these properly
24
25 11043 aaronmk
../VegCore.my.sql/make()
26 8926 aaronmk
{
27
	echo_func; set_make_vars
28 10650 aaronmk
	database=VegCore create_db=1 mysqldump_local --skip-add-drop-table \
29
>"$target"
30 8926 aaronmk
}
31
32 9074 aaronmk
export_mysql()
33 8926 aaronmk
{
34
	echo_func
35 11043 aaronmk
	../VegCore.my.sql/make
36 8926 aaronmk
}
37
38 11041 aaronmk
../VegCore.pg.sql/make()
39 8931 aaronmk
{
40
	echo_func; set_make_vars
41 8944 aaronmk
	sql_ascii=1 my2pg <"${target%.pg.sql}.my.sql" >"$target"
42 8931 aaronmk
}
43
44 9074 aaronmk
export_postgres()
45 8931 aaronmk
{
46
	echo_func
47 11041 aaronmk
	../VegCore.pg.sql/make
48 8931 aaronmk
}
49
50 9074 aaronmk
export_()
51 8654 aaronmk
{
52 8881 aaronmk
	echo_func
53 8935 aaronmk
	(cd "$top_dir"; unzip_newer "$top_filename" document.mwb.xml)
54 8926 aaronmk
	export_mysql
55 8931 aaronmk
	export_postgres
56 8654 aaronmk
}
57
58 9074 aaronmk
import()
59 8654 aaronmk
{
60 8881 aaronmk
	echo_func
61 8935 aaronmk
	(cd "$top_dir"; zip_newer "$top_filename" document.mwb.xml)
62 8654 aaronmk
}
63
64 9074 aaronmk
sync()
65 8654 aaronmk
{
66 8881 aaronmk
	echo_func
67 8936 aaronmk
	export_
68
	import
69 8654 aaronmk
}
70
71 9074 aaronmk
all()
72 8654 aaronmk
{
73 8881 aaronmk
	echo_func
74 8654 aaronmk
	sync
75
}
76 8705 aaronmk
77
fi