db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Devaney" <bdeva...@docfinity.com>
Subject Alter tables/database question
Date Mon, 11 Jun 2007 18:46:46 GMT
I have a few questions about some of the features in the ddlutils
project and I would appreciate some advice.  I am writing an application
to take our model of a database and allow out clients to upgrade their
databases to make sure that we have all the tables, columns etc. that we
need for our software to run.  This is a second attempt at this
application.  The earlier attempt was prior to the existence of ddlutils
and never really went anywhere.  I have the app creating databases with
no problems, but altering an existing database has a couple of


Everything I see seems to be take the database model and alter the
database ddlutils is connected to, to match it.  So if the model has:


Table   column1 varchar(10), column2 integer


And the database has:


Table column1 varchar(10) 


It will generate:

Alter table add column column2 integer


Which is fine, except for the case where the database column has:


Table column1 varchar(10) , usercolumn varchar(20)


The alter script will generate:

Alter table drop column usercolumn

Alter table add column2 integer


If the user has added columns, tables, indicies or anything that does
not exist in the model database, ddlutils will generate a script to
delete those items.  Is there any setting that will indicate to ddlutils
that additional items found in the database are to be kept?  


There is also the case where the database has:

Table column1 varchar(20) columns2 integer


Then the alter script will be:

Alter table modify column1 varchar(10)


With some potentially disasterous results if someone modified the column
width to fit data that they had.  The alter cannot be allowed to run or
that data could be lost.


What I am looking for is some way of making the model a minimum
requirement rather than the exact plan.  If there are extra tables that
do not appear in the model, they should be left alone.  Larger columns
than the model are not truncated, but smaller columns are lengthened to
match.  Missing indicies are added, but any others are not deleted.  

Brian Devaney
DocFinity Solution Developer
DocFinity(r) by Optical Image Technology, Inc.
100 Oakwood Avenue
Suite 700
State College, PA 16803
ph: 814.238.0038
fax: 814.238.0011
www.docfinity.com <http://www.docfinity.com/> 

DISCLAIMER: This email may contain proprietary information, some or all
of which may be legally privileged. It is for the intended recipient
only. If an addressing or transmission error has misdirected this email,
please notify the author by replying to this email. If you are not the
intended recipient, you may not use, disclose, distribute, copy, print,
or rely on this email.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message