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: Ant/DDLUtils questions
Date Sat, 18 Feb 2006 16:20:03 GMT
On 2/18/06, Guy Davis <davis@guydavis.ca> wrote:

> I was hoping you would be able to answer a few of my questions about
> DDLUtils.  Some are questions about DDLUtils functionality; if DDLUtils
> can't do the request currently I'd like to hear if you think it could or
> whether it should.  I'd like to contribute (coding, testing, docs) to
> new features deemed useful and possible by the group.

Sure. And contributions are always welcome.

> 1) The XML file of data dumped from DatabaseToDdl using writeDataToFile
> now loads without a DOCTYPE declaration being added when I use
> validateXml="false" in my DdlToDatabase tag.  (Thanks Thomas!)  However,
> the root tag of the the dump (from Oracle 10g EE) is just <database>.
> When I load, I get an error saying I need a 'name' attribute on the root
> tag.  If I manually add it giving: <database name='SomeName'> then my
> load works fine.  Is there any way to have the name added to the file
> automatically?  If so, what is the setting?

Is a bug, I think. I'll look into it.

> 2) I am unable to get the ON DELETE CASCADE behavior of foreign keys to
> be recorded when dumping schema to XML.  I have verified that my Oracle
> table has a foreign key with Delete Rule set to Cascade, but a schema
> dump does not add `onDelete="cascade"` to the <foreign key> tag in the
> schema.xml.  I can add this attribute to the schema file manually, but a
> load (DdlToDatabase) seems to silently ignore them when creating
> tables.  Any ideas?

DdlUtils currently does not use the onUpdate and onDelete attributes.
Could you file an improvement issue in JIRA ?

> 3) I'd like to add a db.clean target to my Ant build file that drops all
> everything (tables, etc) leaving an empty database.  Is there anything
> in DDLUtils that can do this for the different database types?

You could alter the database to an empty schema, which in effect
should drop all tables and related constraints.

> 4) Is there any way to essentially diff two schema XML files and
> generate database-specific SQL that can be saved to a file?  Ideally,
> I'd like to use for handling database upgrades of our
> product.  This seems to be almost what the WriteSchemaToDatabase command
> is doing for a single schema and a live database with
> alterDatabase=true.   Would it be possible to replace the live database
> with a second schema and then have the SQL sent to a file rather than to
> the live database?

You're right, this should be easy to implement. Again, could you file
a feature request issue in JIRA ?

> 5) Similarly to #4, but diffing two sets of data that has been dumped to
> XML and generating database specific SQL.  Is this even possible for all
> the different ways to change data?  This seems much harder than #4.

Mhmm, I don't know. In general you would create DELETE (for rows that
are not present in the target data set), INSERT (for rows that are not
present in the source data set) and UPDATE statements (for each
changed column).


View raw message