db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoffer Hammarström <krei...@imcode.com>
Subject Renaming columns
Date Fri, 12 Jan 2007 16:20:41 GMT
Hi!

I'm trying to rename and change the type of some columns in MSSQL and
MySQL databases.

I have tables "templates", "text_docs", and "templates_cref".

"templates" has primary key "template_id", which is referred by foreign
keys "text_docs.template_id" and "templates_cref.template_id".

What i want to do is to drop the "templates" table, and then rename the
"template_id" column in "text_docs" and "templates_cref" to
"template_name". Also, i want to change the "template_id" column and a
couple of other columns from an integer column to a varchar(80) column,
and taking their new values from the "simple_name" column corresponding
to the "template_id" in the dropped "templates" table.

I've found no easy way to accomplish this using the ddlutils API.

I can't call column.setName(newColumnName), because that makes ddlutils
think that the old column has been removed and a new column has been added.

Perhaps someone could point me to the best way to do this?

Thanks!

-- 
Christoffer Hammarström
Programmerare, imCMS, http://www.imcode.com/
kreiger@imcode.com



Mime
View raw message