Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

Need to have better control of type generation for a specific database

$
0
0
Hello, I have following changeset:
  1.     <changeSet author="author" id="id">
  2.         <createTable tableName="TABLE1">
  3.             <column autoIncrement="true" name="ID" type="java.lang.Long">
  4.                 <constraints primaryKey="true"primaryKeyName="PK__ID"/>
  5.             </column>
  6.             <column name="NAMESPACE_ID" type="java.lang.Long">
  7.                 <constraints nullable="false"/>
  8.             </column>
  9.             <column name="UUID" type="java.lang.String(256)">
  10.                 <constraints nullable="false"/>
  11.             </column>
  12.             <column name="DESCRIPTION" type="java.lang.String(2000)"/>
  13.             <column name="NAME" type="java.lang.String(255)"/>
  14.             <column name="VALUE" type="java.lang.String(2000)"/>
  15.         </createTable>
  16.     </changeSet>

Which ends up with following scripts for DBMS I'm interested in:
Oracle
  1. CREATE TABLE TABLE1 (ID NUMBER(38, 0) NOT NULL, NAMESPACE_ID NUMBER(19, 0) NOT NULL, UUID VARCHAR2(256) NOT NULL, DESCRIPTION VARCHAR2(2000), NAME VARCHAR2(255), VALUE VARCHAR2(2000), CONSTRAINT PK__ID PRIMARY KEY (ID));
MsSql
  1. CREATE TABLE TABLE1 ([ID] BIGINT IDENTITY (1, 1) NOT NULL, [NAMESPACE_ID] BIGINT NOT NULL, [UUID] VARCHAR(256) NOT NULL, [DESCRIPTION] VARCHAR(2000), [NAME] VARCHAR(255), [VALUE] VARCHAR(2000), CONSTRAINT [PK__ID] PRIMARY KEY ([ID]))
How can I change changeset above to generate slightly different SQLs? See below:

Oracle
  1. CREATE TABLE TABLE1 (ID NUMBER(19, 0) NOT NULL, NAMESPACE_ID NUMBER(19, 0) NOT NULL, UUID VARCHAR2(256 CHAR) NOT NULL, DESCRIPTION VARCHAR2(2000 CHAR), NAME VARCHAR2(255 CHAR), VALUE VARCHAR2(2000 CHAR), CONSTRAINT PK__ID PRIMARY KEY (ID));
MsSql
  1. CREATE TABLE TABLE1 ([ID] BIGINT IDENTITY (1, 1) NOT NULL, [NAMESPACE_ID] BIGINT NOT NULL, [UUID] NVARCHAR(256) NOT NULL, [DESCRIPTION] NVARCHAR(2000), [NAME] NVARCHAR(255), [VALUE] NVARCHAR(2000), CONSTRAINT [PK__ID] PRIMARY KEY ([ID]))
It would be good to be able to define such conversion for all changeset in one place, so I believe modifySql wouldn't help me here.


Viewing all articles
Browse latest Browse all 2993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>