db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Douglas Granzotto (Infoarte)" <dgranzo...@infoarte.trix.net>
Subject Plataform.getAlterTablesSql results
Date Wed, 14 Jun 2006 13:02:30 GMT
Hi,

I am using the following method:
String getAlterTablesSql(Database desiredDb, boolean doDrops, boolean modifyColumns, boolean
continueOnError)
from Plataform

It is returning this sql code:
ALTER TABLE IPI
    ADD CLASSFISCAL VARCHAR(12);

ALTER TABLE IPI
    ALTER CLASSFISCAL POSITION 4;

CREATE TABLE IPI_
(
    IPICOD VARCHAR(2) NOT NULL,
    IPIDESC VARCHAR(30),
    TIPO INTEGER,
    CLASSFISCAL VARCHAR(12),
    VERSAO INTEGER,
    PRIMARY KEY (IPICOD)
);

INSERT INTO IPI_ (CLASSFISCAL,IPICOD,IPIDESC,TIPO,VERSAO) SELECT CLASSFISCAL,IPICOD,IPIDESC,TIPO,VERSAO
FROM IPI;

DROP TABLE IPI;

CREATE TABLE IPI
(
    IPICOD VARCHAR(2) NOT NULL,
    IPIDESC VARCHAR(30),
    TIPO INTEGER,
    CLASSFISCAL VARCHAR(12),
    VERSAO INTEGER,
    PRIMARY KEY (IPICOD)
);

CREATE INDEX IX_IPI_1 ON IPI (IPIDESC);

INSERT INTO IPI (IPICOD,IPIDESC,TIPO,CLASSFISCAL,VERSAO) SELECT IPICOD,IPIDESC,TIPO,CLASSFISCAL,VERSAO
FROM IPI_;

DROP TABLE IPI_;



I believe that it would be necessary, only this:
ALTER TABLE IPI
    ADD CLASSFISCAL VARCHAR(12);

ALTER TABLE IPI
    ALTER CLASSFISCAL POSITION 4;

Since I only added a column.
I don't understand, why of the remaining of the code.
CREATE TABLE IPI_, INSERT INTO IPI_, 
DROP TABLE IPI, etc

Thanks,

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