Tighter integration of Liquibase meta model in liquibase.database.structure

Before I create 20 feature requests, I’ll better ask the forums first

For the jOOQ <-> Liquibase integration attempts, I’d like to be able to navigate between Liquibase meta model objects in any direction. From what I understand, the DatabaseSnapshot is a good entry point in client code, to get a hold of various DatabaseObjects.

However, I’m missing a couple of links, symbolically listed as method declarations (replace arrays with lists, if you prefer):

  1. class Table {
  2.       PrimaryKey getPrimaryKey();
  3.       UniqueConstraint[] getUniqueConstraints();
  4.       UniqueConstraint getUniqueConstraint(String name);
  5.       ForeignKey[] getForeignKeys();
  6.       ForeignKey getForeignKey();
  7. }

And then

  1. // Primary keys are "special" unique constraints. Coupling them more tightly would add some
  2. // expressiveness to the meta API
  3. class PrimaryKey extends UniqueConstraint {
  4. }


  1. class ForeignKey {
  2.       // This could be a PrimaryKey...
  3.       UniqueConstraint getReferencedConstraint();
  4. }

Also, I’m not quite sure about the usefulness of the Schema object. How about adding:

  1. class Schema {
  2.       Table[] getTables();
  3.       View[] getViews();
  4.       Sequence[] getSequences();
  5.       UniqueConstraint[] getUniqueConstraints();
  6.       PrimaryKey[] getPrimaryKeys();
  7.       ForeignKey[] getForeignKeys();
  8. }

Let me know what you think