Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[2e23dc]: dist / bin / make-empty-sql.sh Maximize Restore History

Download this file

make-empty-sql.sh    115 lines (99 with data), 3.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
# bbou@ac-toulouse.fr
# 25/11/2013
# 30|31|31_snapshot
# D A T A B A S E
dbms=$1
shift
if [ -z "${dbms}" ]; then
echo "$0 <dbms:mysql|postgresql|sqlite|template> <dbtag:30|31|31_snapshot>"
exit 1
fi
dbtag=$1
shift
if [ -z "${dbtag}" ]; then
echo "$0 <dbms:mysql|postgresql|sqlite|template> <dbtag:30|31|31_snapshot>"
exit 1
fi
echo "empty ${dbms} ${dbtag}"
# D I R S
distdir="`dirname $(readlink -m $0)`/"
distdir="$(readlink -m ${distdir}/..)"
#echo "distdir=${distdir}"
outdir=${distdir}/data/${dbms}
outdir="$(readlink -m ${outdir})"
#echo "outdir=${outdir}"
builderdir=${distdir}/../run
builderdir="$(readlink -m ${builderdir})"
#echo "builderdir=${builderdir}"
# O U T P U T
output=${outdir}/${dbms}-${dbtag}-empty.sql
#echo "output ${output}"
wn="words casedwords senses synsets linktypes semlinks lexlinks postypes lexdomains morphmaps morphs samples vframemaps vframes vframesentencemaps vframesentences adjpositions adjpositiontypes"
lsenses="senses20 senses21"
lsensemaps="sensemaps2021 sensemaps2130"
lsynsetmaps=""
lcomputedsensemaps=""
case ${dbtag} in
30)
lsenses="${lsenses}"
lcomputedsensemaps=""
lsynsetmaps="synsetmaps2030 synsetmaps2130"
;;
31)
lsenses="${lsenses} senses30"
lcomputedsensemaps="sensemaps3031"
lsynsetmaps="synsetmaps2031 synsetmaps2131 synsetmaps3031"
;;
31_snapshot*)
lsenses="${lsenses} senses30 senses31"
lcomputedsensemaps="sensemaps3031 sensemaps3131_snapshot"
lsynsetmaps="synsetmaps2031_snapshot synsetmaps2131_snapshot synsetmaps3031_snapshot synsetmaps3131_snapshot"
;;
*)
echo "illegal dbtag ${dbtag}"
exit 1
esac
legacy="${lsenses} ${lsensemaps} ${lsynsetmaps} ${lcomputedsensemaps}"
vn="vnclasses vnclassmembers vnclassmembersenses vngroupings vngroupingmaps vnrolemaps vnroles vnroletypes vnselrestrs vnselrestrtypes vnframemaps vnframes vnframenames vnframesubnames vnsemantics vnsyntaxes vnpredicatemaps vnpredicates vnexamplemaps vnexamples"
bnc="bncs bncimaginfs bncconvtasks bncspwrs"
sumo="sumofiles sumoformulas sumoterms sumotermattrs sumomaps sumoparsemaps"
xwn="xwnparselfts xwnwsds"
glf="glfs"
ilfwn="ilfs"
logs="logs"
# D O M A I N S
extensions="legacy vn bnc sumo xwn glf ilfwn logs"
domains="wn ${extensions}"
# F U N C T I O N S
function schema()
{
mytables=$1
mydomain=$2
echo "* dumping schema of ${mytables}"
${builderdir}/bin/run-${dbms}-${dbtag}.sh dump ${mydomain} table creates >> ${output} 2> /dev/null
}
function constraints()
{
mydomain=$1
myswitch=${mydomain}
echo "* dumping constraints ${mydomain}"
${builderdir}/bin/run-${dbms}-${dbtag}.sh dump ${mydomain} constraint drops >> ${output} 2> /dev/null
${builderdir}/bin/run-${dbms}-${dbtag}.sh dump ${mydomain} constraint creates >> ${output} 2> /dev/null
}
function views()
{
mydomain=$1
myswitch=${mydomain}
echo "* dumping views ${mydomain}"
${builderdir}/bin/run-${dbms}-${dbtag}.sh dump ${mydomain} view creates >> ${output} 2> /dev/null
}
# M A I N
mkdir -p ${outdir}
echo "-- ${dbms}" > ${output}
for domain in ${domains}; do
eval tables=\$${domain}
schema "${tables}" "${domain}"
constraints "${domain}"
views "${domain}"
done