db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Dudziak" <tom...@gmail.com>
Subject Re: writeSchemaSqlToFile didnt work for me.
Date Sat, 12 May 2007 18:49:07 GMT
On 5/11/07, Jason <jeacott@hardlight.com.au> wrote:
> 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>

You might have to specify a schema pattern (attribute schemapattern of
the databaseToDdl task) for PostgreSQL.
You can also set the verbosity to INFO or even DEBUG to get more info
about what DdlUtils does.

> 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)

This will be possible with some of the extensions proposed for version
1.1, but for now I'd suggest that you use PostgreSql' backup and
restore functionality instead.

Tom

Mime
View raw message