Hi all,
I just checked out the latest head and built it (RC1), then ran it
against a postgres 7.4 db. (This is the first time I have tried ddlutils
after about 18 months!)
The writeSchemaToFile and writeDataToFile both produced output but
writeSchemaSqlToFile produced an empty file.
I tried it with 2 drivers, pg74.216.jdbc3.jar, and
postgresql-8.2dev-503.jdbc3.jar.
This is my Ant target:
<target name="database-dump-postgres" description="Dumps the
database structure" depends=$
<taskdef name="databaseToDdl"
classname="org.apache.ddlutils.task.DatabaseToDdlTask">
<classpath refid="runtime-classpath"/>
</taskdef>
<delete dir="${database.backup.path}/src/schema"></delete>
<mkdir dir="${database.backup.path}/src/schema"/>
<databaseToDdl modelName="MyModel" databaseType="postgresql"
useDelimitedSqlIdentifiers="true"/>
<database
url="jdbc:postgresql://${system.database.hostname}/${database.name}"
driverClassName="org.postgresql.Driver"
username="${database.user}"
password="${database.password}"/>
<writeSchemaToFile
outputFile="${database.backup.path}/src/schema/${database.backup.path}-schema.xml"/>
<writeDataToFile
outputFile="${database.backup.path}/src/schema/${database.backup.path}-data.xml">
</writeDataToFile>
<writeSchemaSqlToFile
outputFile="${database.backup.path}/src/schema/${database.backup.path}-schema.sql">
</writeSchemaSqlToFile>
</databaseToDdl>
</target>
What I REALLY want is to be able to round trip this database back into
postgres with all the same datatypes, but I'm not sure how I should do
this. I think it should be a default option somewhere - eg dont mess
with my db, just restore it please. specifically I a concerned about
date field mappings (timestamptz should restore as timestamptz) and
bytea->Blob/Clob->bytea (I think it produces
bytea->Blob/Clob->longbinaryvarchar instead)
Hints/Thoughts greatly appreciated.
Jason.