2006-12-17 22:41:06 +07:00
|
|
|
<project name="create-db" default="create" basedir=".">
|
|
|
|
<property file="build.properties" />
|
|
|
|
<path id="lib.path">
|
|
|
|
<fileset dir="../lib">
|
|
|
|
<include name="**/*.jar" />
|
|
|
|
</fileset>
|
|
|
|
</path>
|
|
|
|
<taskdef resource="net/sf/antcontrib/antlib.xml">
|
|
|
|
<classpath>
|
|
|
|
<fileset dir="../lib">
|
|
|
|
<include name="**/*.jar" />
|
|
|
|
</fileset>
|
|
|
|
</classpath>
|
|
|
|
</taskdef>
|
|
|
|
|
|
|
|
<target name="create" depends="init,create-database,load-functions,create-schema,load-data,load-others">
|
|
|
|
</target>
|
|
|
|
<target name="init">
|
|
|
|
<echo message="============================================================" />
|
|
|
|
<echo message=" PostgreSQL database create tool for Adempiere ERP" />
|
|
|
|
<echo message=" Adempiere Licese is GNU GPL License" />
|
|
|
|
<echo message="============================================================" />
|
|
|
|
<echo message="" file="log/psql.log" append="false" />
|
|
|
|
<echo append="false" file="log/build.log" message="#Build log:${line.separator}${line.separator}" />
|
|
|
|
</target>
|
|
|
|
<target name="create-database">
|
|
|
|
<ant antfile="build-ddl.xml" target="createDb" />
|
|
|
|
</target>
|
|
|
|
<target name="create-schema">
|
|
|
|
<echo message="----- Creating tables -----" />
|
|
|
|
<ant antfile="build-ddl.xml" target="writeSchemaSqlToFile" />
|
|
|
|
<echo file="log/psql.log" append="true" message="${line.separator}#Create Tables:${line.separator}${line.separator}" />
|
|
|
|
<antcall target="load">
|
|
|
|
<param name="file.name" value="${basedir}/adempiere-schema.sql" />
|
|
|
|
</antcall>
|
|
|
|
</target>
|
|
|
|
<target name="load-data">
|
|
|
|
<echo message="----- Loading Adempiere Seed data -----" />
|
|
|
|
<ant antfile="build-ddl.xml" target="writeDataToDb" />
|
|
|
|
</target>
|
2007-01-14 05:41:39 +07:00
|
|
|
|
|
|
|
<!-- ==================================================== -->
|
|
|
|
<!-- Init -->
|
|
|
|
<!-- ==================================================== -->
|
|
|
|
<target name="setupInit" >
|
|
|
|
<!-- Environment variables -->
|
|
|
|
<condition property="isWindows">
|
|
|
|
<os family="windows" />
|
|
|
|
</condition>
|
|
|
|
</target>
|
|
|
|
|
2007-01-26 17:06:05 +07:00
|
|
|
<target name="install-pljava" depends="setupInit" unless="isWindows"
|
2007-01-14 05:41:39 +07:00
|
|
|
description="Non Windows Setup" >
|
|
|
|
<echo message="----- Loading PLJAVa to Linux " />
|
|
|
|
<ant antfile="build-pljava.xml" target="init" />
|
|
|
|
</target>
|
2006-12-17 22:41:06 +07:00
|
|
|
|
|
|
|
<target name="load-functions">
|
|
|
|
<echo append="false" file="load_sqlj_functions.sql">
|
|
|
|
CREATE SCHEMA adempiere;
|
|
|
|
</echo>
|
|
|
|
<echo append="true" file="load_sqlj_functions.sql">
|
|
|
|
SET search_path TO adempiere,sqlj;
|
|
|
|
</echo>
|
|
|
|
<echo append="true" file="load_sqlj_functions.sql">
|
|
|
|
SELECT sqlj.install_jar('${sqlj.jar.url}', 'sqlj', true);
|
|
|
|
</echo>
|
|
|
|
<echo append="true" file="load_sqlj_functions.sql">
|
|
|
|
SELECT sqlj.set_classpath('adempiere', 'sqlj');
|
|
|
|
</echo>
|
|
|
|
|
|
|
|
<echo file="log/psql.log" append="true" message="${line.separator}#Create Functions and Operators:${line.separator}${line.separator}" />
|
|
|
|
<antcall target="load">
|
|
|
|
<param name="file.name" value="${basedir}/load_sqlj_functions.sql" />
|
|
|
|
</antcall>
|
|
|
|
<antcall target="load">
|
2007-01-26 17:06:05 +07:00
|
|
|
<param name="file.name" value="${basedir}/functions/getDate.sql" />
|
|
|
|
</antcall>
|
|
|
|
<antcall target="load">
|
|
|
|
<param name="file.name" value="${basedir}/functions/charAt.sql" />
|
|
|
|
</antcall>
|
|
|
|
<antcall target="load">
|
|
|
|
<param name="file.name" value="${basedir}/functions/firstOf.sql" />
|
|
|
|
</antcall>
|
|
|
|
<antcall target="load">
|
|
|
|
<param name="file.name" value="${basedir}/functions/addDays.sql" />
|
|
|
|
</antcall>
|
|
|
|
<antcall target="load">
|
|
|
|
<param name="file.name" value="${basedir}/functions/daysBetween.sql" />
|
|
|
|
</antcall>
|
|
|
|
<antcall target="load">
|
|
|
|
<param name="file.name" value="${basedir}/functions/trunc.sql" />
|
|
|
|
</antcall>
|
|
|
|
<antcall target="load">
|
|
|
|
<param name="file.name" value="${basedir}/operators.sql" />
|
2007-01-24 07:41:08 +07:00
|
|
|
</antcall>
|
2007-01-25 12:15:06 +07:00
|
|
|
|
2006-12-17 22:41:06 +07:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="load-others">
|
|
|
|
<echo message="----- Loading other database objects -----" />
|
|
|
|
<echo file="log/psql.log" append="true" message="${line.separator}#Create Views [1st Pass]:${line.separator}${line.separator}" />
|
|
|
|
<foreach param="file.name" target="load">
|
|
|
|
<path>
|
2007-02-12 09:20:14 +07:00
|
|
|
<fileset dir="views">
|
2006-12-17 22:41:06 +07:00
|
|
|
<include name="**" />
|
|
|
|
</fileset>
|
|
|
|
</path>
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
<echo file="log/psql.log" append="true" message="${line.separator}#Create Views [2nd Pass]:${line.separator}${line.separator}" />
|
|
|
|
<foreach param="file.name" target="load">
|
|
|
|
<path>
|
2007-02-12 09:20:14 +07:00
|
|
|
<fileset dir="views">
|
2006-12-17 22:41:06 +07:00
|
|
|
<include name="**" />
|
|
|
|
</fileset>
|
|
|
|
</path>
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
<echo file="log/psql.log" append="true" message="${line.separator}#Create Sequences:${line.separator}${line.separator}" />
|
|
|
|
<foreach param="file.name" target="load">
|
|
|
|
<path>
|
|
|
|
<fileset dir="../sequences">
|
|
|
|
<include name="**" />
|
|
|
|
</fileset>
|
|
|
|
</path>
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
<ant antfile="build-ddl.xml" target="writeFkSqlToFile" />
|
|
|
|
<echo file="log/psql.log" append="true" message="${line.separator}#Create Foreign Keys:${line.separator}${line.separator}" />
|
|
|
|
<antcall target="load">
|
|
|
|
<param name="file.name" value="${basedir}/adempiere-fk.sql" />
|
2007-01-25 12:15:06 +07:00
|
|
|
</antcall>
|
|
|
|
<antcall target="load">
|
|
|
|
<param name="file.name" value="${basedir}/install_procedures.sql" />
|
2006-12-17 22:41:06 +07:00
|
|
|
</antcall>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="load">
|
|
|
|
<echo message="Loading file ${file.name}" />
|
|
|
|
<exec dir="${postgresql.home}/bin" executable="${postgresql.home}/bin/psql" resultproperty="psql.result" output="log/psql.log" append="true">
|
2007-01-14 05:41:39 +07:00
|
|
|
<arg line="-d ${postgresql.database} -q" />
|
|
|
|
<arg line="-U ${postgresql.user}" />
|
2006-12-17 22:41:06 +07:00
|
|
|
<arg line="-f ${file.name}" />
|
|
|
|
<env key="PGPASSWORD" value="${postgresql.password}" />
|
|
|
|
</exec>
|
|
|
|
<echo message="File ${file.name} status ${psql.result}" />
|
|
|
|
<echo append="true" file="log/build.log">File ${file.name} status ${psql.result}</echo>
|
|
|
|
<echo append="true" file="log/build.log" message="${line.separator}" />
|
|
|
|
</target>
|
|
|
|
|
|
|
|
</project>
|
|
|
|
|
|
|
|
|