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

Re : Extending Liquibase CreateTableStatement

$
0
0
I think I'm almost at a point where my extension should be workable.  I created the following:

liquibase.ext.pgxl.change.CreateTableChangePgxl - extends AbstractChange implements ChangeWithColumns<ColumnConfig>

liquibase.ext.pgxl.database.PgxlDatabase - extends AbstractJdbcDatabase

liquibase.ext.pgxl.sqlgenerator.CreateTableGeneratorPgxl - extends AbstractSqlGenerator<CreateTableStatementPgxl>

liquibase.ext.pgxl.statement.CreateTableStatementPgxl - extends CreateTableStatement


and registered them in my MANIFEST:

  1. Liquibase-Package: liquibase.ext.pgxl.change,liquibase.ext.pgxl.database,liquibase.ext.pgxl.sqlgenerator,liquibase.ext.pgxl.statement

I've also created an extension xsd which adds the distributionType and Column attributes.:

  1. <?xml version="1.0" encoding="UTF-8"?>

    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:lb="http://www.liquibase.org/xml/ns/dbchangelog"
    targetNamespace="http://www.liquibase.org/xml/ns/dbchangelog-ext/liquibase-postgresxl"
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog-ext/liquibase-postgresxl"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"
    elementFormDefault="qualified">
    <xsd:import namespace="http://www.liquibase.org/xml/ns/dbchangelog"
    schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd" />


    <xsd:element name="createPgxlTable">
    <xsd:complexType>
    <xsd:choice maxOccurs="unbounded">
    <xsd:element ref="lb:column" minOccurs="1" maxOccurs="unbounded"/>
    <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:choice>
    <xsd:attributeGroup ref="lb:tableNameAttribute"/>
    <xsd:attribute name="tablespace" type="xsd:string"/>
    <xsd:attribute name="distributionType" type="xsd:string"/>
    <xsd:attribute name="distributionColumn" type="xsd:string"/>
    <xsd:attribute name="remarks" type="xsd:string"/>
    <xsd:anyAttribute namespace="##other" processContents="lax"/>
    </xsd:complexType>
    </xsd:element>

    </xsd:schema>


I then try to use this in my changelog:

  1. <databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext/liquibase-postgresxl"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
    http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
    http://www.liquibase.org/xml/ns/dbchangelog-ext/liquibase-postgresxl ../../resources/xsd/changelog-ext.xsd"

    >

    <changeSet id="9" author="Rob">
    <ext:createPgxlTable tableName="test" distributionType="HASH" distributionColumn="ID" schemaName="shared_data">
    <column autoIncrement="false" name="ID" type="INTEGER" />
    </ext:createPgxlTable>
    </changeSet>


    </databaseChangeLog>


But when I run liquibase update or updateSQL, my changeset runs...  but does nothing with the createPgxlTable.  It seems like something isn't being registered with liquibase.

Viewing all articles
Browse latest Browse all 2993

Trending Articles



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