How to change datatype to 'text in row (2048)'

I’m trying to apply a changeset to 1 of our Sybase databases (Sybase is not my choice. I just have to work with it :slight_smile: )

A column with datatype ‘text’ takes up too much space and we want to convert it to type ‘text in row (2048)’. (A Sybase specific datatype that handles variable text-length better)

The Changeset looks like this

  <changeSet author="..." id="..."  >
    <modifyDataType tableName="..." columnName="..." newDataType="text in row (2048)"/>
    <rollback>
      <modifyDataType tableName="..." columnName="..." newDataType="text"/>
    </rollback>
  </changeSet>

This changesets gives no problems when applied. But the datatype has not changed. It is still of type ‘text’.

It seems that anything after the first space in newDataType is removed. For instance: The following changeset works on postgresql.

  <changeSet author="..." id="..."  >
    <modifyDataType tableName="..." columnName="..." newDataType="text but the rest is not sql"/>
  </changeSet>

How can I use modifyDataType with "text in row (2048)" as newDataType?

I seem to have found an answer to my own problem. It does not look very pretty. But it works :slight_smile:

<modifyDataType tableName="..." columnName="..." newDataType='text&#160;in&#160;row&#160;(2048)'/>

&nbsp; did not work. But the unicode equivalent works.

I found a better solution. Since this is a Sybase specific issue. I can use direct SQL to alter this table.
I totally forgot that you can always use direct SQL in liquibase :slight_smile:

 <changeSet author="..." id="..." dbms="sybase">
    <sql>alter table ... modify ... text in row (2048)</sql>
    <rollback>
      <sql>alter table ... modify ... text</sql>
    </rollback>
  </changeSet>