Is complex functionality in Postgres supported?

Hi all!

I have a newbie question: is complex functionality in Postgres supported?

We have very complex database that uses the following (in addition to regular DDL SQL):

CREATE OR REPLACE VIEW

CREATE OR REPLACE RULE

CREATE OR REPLACE FUNCTION

CREATE TRIGGER

REVOKE ALL

GRANT ALL

I consider now to use Liquibase, but I afraid it may not work after a big effort.

I do understand that we need to use Custom SQL (http://www.liquibase.org/manual/custom_sql ).

Question, if Liquibase will be able to understand that the Custom SQL is changed (for example a Custom SQL for the creation of a function) and will change the specific Custom SQL for the new one.

Any help will be appreciated.

Best regards,

   Michael

Liquibase doesn’t have built-in tags for those more complex functions, so you do have to use the tag to call them.


I’m not sure I understand your question about “if liquibase will be able to understand that the custo SQL is changed”. 


Nathan

Dear Nathan,

Thank you for your reply!

I will clarify about "if liquibase will be able to understand that the custom SQL is changed". 

According to my understanding the main benefit of liquibase is automatic upgrade. I just need to create a Changelog File and liquibase will update my schema.

My question what will happens if my Changelog File will contain the tag?

For example, if I created the following rule using the tag:

  1. CREATE OR REPLACE RULE my_delete_rule AS ON DELETE TO my_view
  2.                 DO INSTEAD
  3.                                 type = 'original' ;

Then, I will change the rule to the following:

  1. CREATE OR REPLACE RULE my_delete_rule AS ON DELETE TO my_view
  2.                 DO INSTEAD
  3.                                 type = 'new'       ;

Will liquibase understand that it is required to change my_delete_rule and will update my schema?

Do you know if somebody already implemented the complex database using liquibase? 

Thanks in advance!

Best regards,

   Michael

When you create liquibase chagneSets, the normal usage is to not go back and modify existing changeSets, but rather to add a new changeSet that takes what has already ran and modify that. It uses the id/author/filename combination to track which changesets have ran, and if you modify an already ran changeSet it will throw an exception (we store a checksum of the changeset in the database) 

Nathan

Dear Nathan,

I will happy to know the following:

1) I will create my schema using Changelog File that will contain the first rule above.

2) I will update the line 8 in the tag

3) I will run liquibase once again.

Will liquibase understand that it is required to change my_delete_rule and will update my schema?

Do you know if somebody already implemented the complex database using liquibase? 

 

Thanks in advance!

Best regards,

   Michael