38773

Create column of type double precision[] with liquibase

How to create column of type double precision[] (array of doubles) with liquibase in postgresql database?

<changeSet id="add t_name table"> <createTable tableName="t_name"> ... <column name="doubleArray" type="???"/> ... </createTable> </changeSet>

Google didn't help, please, if someone knows a solution, I will be very appreciative.

Answer1:

I finally found the answer with help of my colleague. It seems that liquibase don't know such types, so we need to modify sql query manually:

<createTable tableName="t_name"> ... <column name="doubleArray" type="DOUBLE_ARRAY"/> ... </createTable> <modifySql dbms="postgresql"> <replace replace="DOUBLE_ARRAY" with="double precision[][]"/> </modifySql>

Answer2:

Liquibase 3.3.0 is able to generate precision for double type. e.g. "type=double precision[16][2]" generates double(16,2) in mysql.

Answer3:

If you rely on Postgresql, you can use the float8 built-in alias:

<column name="doubleArray" type="float8[]"/>

Recommend

  • How to get length of path?
  • loop describes in mocha based on set up in before block
  • Green Dao onUpdate. How can I add new columns to old tables?
  • I have deserialized C# class and i want to save it sqlite using xamarin forms PCL
  • How to create a db3 database with Sqlite-Net
  • miglayout with jtable with issue
  • I want to convert a MySQL query into PDO? [closed]
  • How to scroll two or more JTables with a single Scrollbar?
  • Yii2 migrations. Percentage sign and brackets in table name
  • ASYNC in Node.JS
  • Vaadin Table does not update no matter what I try
  • DOMParser.parseFromString(text,“text/html”) only interprets the first ~21,500 Bytes. Is this a bug?
  • What happens when I strip one version of a mercurial repository and try to synchronize with another
  • Automatic update of parent record updated_at field (Elixir-Ecto)
  • Yii - Error on adding foreign Keys using migrate
  • Difference between a changeset and a patch?
  • Seeking advice on Jetty HttpClient Hang
  • Excel - Autoshape get it's name from cell (value)
  • Check if a string to interpolate provides expected placeholders
  • Google cloud sdk not working when python points python3
  • Delete MySQLi record without showing the id in the URL
  • RestKit - RKRequestDelegate does not exist
  • Unanticipated behavior
  • Traverse Array and Display in markup
  • Comma separated Values
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • using HTMLImports.whenReady not working in chrome
  • Angular 2 constructor injection vs direct access
  • Trying to get generic when generic is not available
  • Java static initializers and reflection
  • How to stop GridView from loading again when I press back button?
  • Android Google Maps API OnLocationChanged only called once
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Android Heatmap on canvas or ImageView
  • Conditional In-Line CSS for IE and Others?