<project name="Database creation" basedir=".">
<property name="sql.driver" value="org.gjt.mm.mysql.Driver"/>
<property name="sql.url" value="jdbc:mysql://localhost/sample_project"/>
<property name="sql.user" value=""/>
<property name="sql.pass" value=""/>
<target name="createTables_MySQL">
<sql driver="${sql.driver}" url="${sql.url}" userid="${sql.user}" password="${sql.pass}" >
<classpath>
<pathelement location="mysql-connector-java-3.0.9-stable-bin.jar"/>
</classpath>
use sample_project;
<transaction src="employees.sql"/>
<transaction src="project.sql"/>
<transaction src="timetable.sql"/>
</sql>
</target>
<target name="createDB_MySQL">
<sql driver="${sql.driver}"
url="${sql.url}"
userid="${sql.user}"
password="${sql.pass}"
classpath="mysql-connector-java-3.0.9-stable-bin.jar"
src="sample_project.sql"/>
</target>
<target name="dropDB_MySQL">
<input message="Do you really want to delete this table (y/n)?" validargs="y,n" addproperty="do.delete" />
<condition property="do.abort">
<equals arg1="n" arg2="${do.delete}"/>
</condition>
<fail if="do.abort">Build aborted by user.</fail>
<sql driver="${sql.driver}" url="${sql.url}" userid="${sql.user}" password="${sql.pass}" >
<classpath>
<pathelement location="mysql-connector-java-3.0.9-stable-bin.jar"/>
</classpath>
drop database sample_project;
</sql>
</target>
</project>
<!--
-- File: TIMETABLE.sql
CREATE TABLE TIMETABLE (
PROJECT_ID BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
EMPLOYEE_ID BIGINT NOT NULL
);
-- File: PROJECT.sql
CREATE TABLE PROJECT (
PROJECT_ID BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
PROJECT_NAME TEXT NOT NULL
);
-- File: EMPLOYEES.sql
CREATE TABLE EMPLOYEES (
EMPLOYEE_ID BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
EMPLOYEE_NAME TEXT NOT NULL
);
-->
|