Can I create partitioned table like:
CREATE TABLE person(
id INT NOT NULL,
NAME VARCHAR(30),
borned TIMESTAMP)
PARTITION BY RANGE (UNIX_TIMESTAMP(borned)) (
PARTITION p0 VALUES LESS THAN (UNIX_TIMESTAMP('2000-01-01 00:00:00')),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
using liquibase tags? I mean not with custom <sql>
but with <createTable>
Since 1.9: You can use modifySql
to append to the createTable
output
<changeSet author="StackOverflow" id="C0FE77AA-5517-11E7-8CAD-224C16886A7C">
<createTable tableName="test">
<column name="id" type="INT">
<constraints nullable="false"/>
</column>
<column name="NAME" type="VARCHAR(30)"/>
<column name="borned" type="TIMESTAMP"/>
</createTable>
<modifySql dbms="postgresql">
<append value=" PARTITION BY RANGE (UNIX_TIMESTAMP(borned)) (
PARTITION p0 VALUES LESS THAN (UNIX_TIMESTAMP('2000-01-01 00:00:00')),
PARTITION p1 VALUES LESS THAN (MAXVALUE))"/>
</modifySql>
</changeSet>
Liquibase outputs the following SQL (according to the updateSql
goal):
CREATE TABLE db.test (id INT NOT NULL, NAME VARCHAR(30) NULL, borned timestamp NULL) PARTITION BY RANGE (UNIX_TIMESTAMP(borned)) ( PARTITION p0 VALUES LESS THAN (UNIX_TIMESTAMP('2000-01-01 00:00:00')), PARTITION p1 VALUES LESS THAN (MAXVALUE));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With