Extending Liquibase CreateTableStatement

Thanks for responding Nathan.  

I have:

-- Lock Database UPDATE public.databasechangeloglock SET LOCKED = TRUE, LOCKEDBY = ' (', LOCKGRANTED = '2016-05-18 18:49:28.290' WHERE ID = 1 AND LOCKED = FALSE;  -- Changeset changelog/changelog.xml::11::Rob INSERT INTO public.databasechangelog (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE) VALUES ('11', 'Rob', 'changelog/changelog.xml', NOW(), 9, '7:d41d8cd98f00b204e9800998ecf8427e', 'Empty', '', 'EXECUTED', NULL, NULL, '3.4.2');  -- Release Database Lock UPDATE public.databasechangeloglock SET LOCKED = FALSE, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;

I tried setting it higher, but still the same result.

I’m going to try and maybe get it up on github, I’m not sure what else to try.

I need a simple extension to Liquibase to add a distribution clause to a postgresql variant.  I’ve created a project with a database that extends PostgresDatabase, a CreateTableGeneratorX that extends CreateTableGenerator and implements generateSql and a CreateTableStatementX that adds the properties that I need to set for the distribution clause.  The generated SQL should look something like:

CREATE TABLE MYTABLE(columns…) distribute by HASH(column1);

I want to add the “distribute by” to the changleLog, XML or SQL DSL.  Can anyone tell me how to do this last part and test it?  The documentation for extension still seems fairly outdated.

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

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

liquibase.ext.pgxl.sqlgenerator.CreateTableGeneratorPgxl - extends AbstractSqlGenerator

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

and registered them in my MANIFEST:

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.

In CreateTableChangePgxl did you annotate it with @DatabseChange and a priority higher than PRIORITY_DEFAULT? 

Also, do you have a CreateTableGenerator subclass that uses the new Statement class?


Try using a higher priority than PRIORITY_DATABASE. The standard database-specific CreateTable implemetnations will use that as well and may be selected instead. 

Try just setting priority to 100 on both classes.


If you could zip up your code and attach it or send it to me at nathan@liquibase.org I could take a look as well.