forked from apache/ddlutils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-sample.xml
166 lines (150 loc) · 6.74 KB
/
build-sample.xml
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project default="writeSchemaSqlToFile"
name="DdlUtils"
basedir=".">
<!-- Allow values set at the commandline or in the environment to override the defaults -->
<property environment="env"/>
<!-- Load the jdbc properties as specified by the jdbc.properties.file variable-->
<property file="${jdbc.properties.file}"/>
<!-- Load the build properties -->
<property file="build.properties"/>
<!-- These properties can be overriden on the commandline using -D -->
<property name="schemafiles" value="testmodel.xml"/>
<property name="schemafile" value="testmodel.xml"/>
<property name="datafile" value="testdata.xml"/>
<property name="catalogpattern" value=""/>
<property name="schemapattern" value=""/>
<property name="sqloutputfile" value="schema.sql"/>
<property name="platform" value=""/>
<property name="alterdatabase" value="true"/>
<property name="delimitedsqlidentifiers" value="false"/>
<property name="verbosity" value="info"/>
<property name="useexplicitidentityvalues" value="false"/>
<!-- The classpath used for running the tasks -->
<path id="project-classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
<pathelement path="${build.java.dir}"/>
</path>
<taskdef classname="org.apache.ddlutils.task.DdlToDatabaseTask"
name="ddlToDatabase"
classpathref="project-classpath"/>
<taskdef classname="org.apache.ddlutils.task.DatabaseToDdlTask"
name="databaseToDdl"
classpathref="project-classpath"/>
<target name="createDb">
<ddlToDatabase usedelimitedsqlidentifiers="${delimitedsqlidentifiers}"
catalogpattern="${catalogpattern}"
schemapattern="${schemapattern}"
databasetype="${platform}"
verbosity="${verbosity}">
<database driverclassname="${datasource.driverClassName}"
url="${datasource.url}"
username="${datasource.username}"
password="${datasource.password}"/>
<createdatabase failonerror="false"/>
</ddlToDatabase>
</target>
<target name="writeSchemaToDb">
<ddlToDatabase validatexml="false"
usedelimitedsqlidentifiers="${delimitedsqlidentifiers}"
catalogpattern="${catalogpattern}"
schemapattern="${schemapattern}"
databasetype="${platform}"
verbosity="${verbosity}">
<database driverclassname="${datasource.driverClassName}"
url="${datasource.url}"
username="${datasource.username}"
password="${datasource.password}"/>
<fileset dir=".">
<include name="${schemafiles}"/>
</fileset>
<writeschematodatabase alterdatabase="${alterdatabase}"
dodrops="true"
failonerror="false"/>
</ddlToDatabase>
</target>
<target name="readSchemaFromDb">
<databaseToDdl usedelimitedsqlidentifiers="${delimitedsqlidentifiers}"
catalogpattern="${catalogpattern}"
schemapattern="${schemapattern}"
databasetype="${platform}"
verbosity="${verbosity}">
<database driverclassname="${datasource.driverClassName}"
url="${datasource.url}"
username="${datasource.username}"
password="${datasource.password}"/>
<writeschematofile outputfile="${schemafile}"/>
</databaseToDdl>
</target>
<target name="writeSchemaSqlToFile">
<ddlToDatabase validatexml="false"
usedelimitedsqlidentifiers="${delimitedsqlidentifiers}"
catalogpattern="${catalogpattern}"
schemapattern="${schemapattern}"
databasetype="${platform}"
verbosity="${verbosity}">
<database driverclassname="${datasource.driverClassName}"
url="${datasource.url}"
username="${datasource.username}"
password="${datasource.password}"/>
<fileset dir=".">
<include name="${schemafiles}"/>
</fileset>
<writeschemasqltofile alterdatabase="${alterdatabase}"
dodrops="true"
failonerror="false"
outputfile="${sqloutputfile}"/>
</ddlToDatabase>
</target>
<target name="writeDataToDb">
<ddlToDatabase validatexml="false"
usedelimitedsqlidentifiers="${delimitedsqlidentifiers}"
catalogpattern="${catalogpattern}"
schemapattern="${schemapattern}"
databasetype="${platform}"
verbosity="${verbosity}">
<database driverclassname="${datasource.driverClassName}"
url="${datasource.url}"
username="${datasource.username}"
password="${datasource.password}"/>
<fileset dir=".">
<include name="${schemafiles}"/>
</fileset>
<writedatatodatabase datafile="${datafile}"
usebatchmode="false"
useexplicitidentityvalues="${useexplicitidentityvalues}"/>
</ddlToDatabase>
</target>
<target name="readDataFromDb">
<databaseToDdl usedelimitedsqlidentifiers="${delimitedsqlidentifiers}"
catalogpattern="${catalogpattern}"
schemapattern="${schemapattern}"
databasetype="${platform}"
verbosity="${verbosity}">
<database driverclassname="${datasource.driverClassName}"
url="${datasource.url}"
username="${datasource.username}"
password="${datasource.password}"/>
<writedatatofile outputfile="${datafile}"/>
</databaseToDdl>
</target>
</project>