From 80fc431853a7105b2f1921de61d06f0fbd0cc51a Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 13 Jun 2020 16:59:04 +0200 Subject: Add Liquibase. Change-Id: I95f2e630f03bcf08c5a8fb2dfba80021da350c75 --- pom.xml | 47 +- src/main/resources/application.properties | 5 +- src/main/resources/db/changeLog-1.0.xml | 1163 ++++++++++++++++++++++++++++ src/main/resources/db/changeLog.xml | 11 + src/main/resources/db/liquibase.properties | 3 + 5 files changed, 1221 insertions(+), 8 deletions(-) create mode 100644 src/main/resources/db/changeLog-1.0.xml create mode 100644 src/main/resources/db/changeLog.xml create mode 100644 src/main/resources/db/liquibase.properties diff --git a/pom.xml b/pom.xml index f00f01b..906386c 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,8 @@ 1.6.1 5.5.0 1.13.1 + 3.9.0 + 42.2.14 1.13.0 @@ -127,10 +129,6 @@ io.quarkus quarkus-elytron-security-properties-file - - io.quarkus - quarkus-flyway - io.quarkus quarkus-hibernate-orm-panache @@ -143,6 +141,10 @@ io.quarkus quarkus-jdbc-postgresql + + io.quarkus + quarkus-liquibase + io.quarkus quarkus-oidc @@ -259,6 +261,43 @@ + + + org.liquibase + liquibase-maven-plugin + ${liquibase.version} + + src/main/resources/db/liquibase.properties + + + + org.liquibase.ext + liquibase-hibernate5 + ${liquibase.version} + + + org.hibernate + hibernate-core + ${hibernate.version} + + + org.hibernate + hibernate-entitymanager + ${hibernate.version} + + + org.hibernate + hibernate-envers + ${hibernate.version} + + + org.postgresql + postgresql + ${postgresql.version} + + + + com.diffplug.spotless diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 6c2146e..2bcffcc 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -14,10 +14,7 @@ quarkus.datasource.driver = org.postgresql.Driver quarkus.datasource.max-size = 8 quarkus.datasource.min-size = 0 -#quarkus.flyway.migrate-at-start = true -#quarkus.flyway.baseline-on-migrate = true -#quarkus.flyway.baseline-version = 1 -#quarkus.flyway.schemas = public +quarkus.liquibase.migrate-at-start = true %dev.quarkus.datasource.url = jdbc:postgresql://localhost:5432/mulkcms %dev.quarkus.datasource.username = mulk diff --git a/src/main/resources/db/changeLog-1.0.xml b/src/main/resources/db/changeLog-1.0.xml new file mode 100644 index 0000000..c4c911a --- /dev/null +++ b/src/main/resources/db/changeLog-1.0.xml @@ -0,0 +1,1163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT a.id AS article, + count(c.*) AS comment_count + FROM (articles a + LEFT JOIN comments c ON (((c.article = a.id) AND (EXISTS ( SELECT comment_revisions.id, + comment_revisions.comment, + comment_revisions.date, + comment_revisions.content, + comment_revisions.author, + comment_revisions.format, + comment_revisions.status, + comment_revisions.article_revision, + comment_revisions.submitter_ip, + comment_revisions.submitter_user_agent + FROM comment_revisions + WHERE ((comment_revisions.comment = c.id) AND ((comment_revisions.status)::text = ANY + (ARRAY[('approved'::character varying)::text, ('trusted'::character varying)::text])))))))) + GROUP BY a.id; + + + + + + + + + + + + + SELECT + article_revisions.article, + article_revisions.id AS revision + FROM (( SELECT article_revisions_1.id + FROM article_revisions article_revisions_1 + EXCEPT + SELECT article_revision_parenthood.parent + FROM article_revision_parenthood) branch_tips + JOIN article_revisions USING (id)); + + + + + SELECT + article_revisions.article, + min(article_revisions.date) AS publishing_date + FROM article_revisions + WHERE ((article_revisions.status)::text = ANY (ARRAY[('published'::character varying)::text, + ('syndicated'::character varying)::text])) + GROUP BY article_revisions.article; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WITH + RECURSIVE t(superrole, subrole) AS ( + SELECT roles.id, + roles.id + FROM roles + UNION + SELECT t_1.superrole, + rs.subrole + FROM (t t_1 + JOIN role_subroles rs ON ((rs.superrole = t_1.subrole))) + ) + SELECT t.superrole, + t.subrole + FROM t; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + ur."user", + er.subrole AS role + FROM (user_roles ur + JOIN effective_role_subroles er ON ((er.superrole = ur.role))) + UNION + SELECT u.id AS "user", + rt.role + FROM users u, + role_tags rt + WHERE ((rt.tag)::text = ANY (ARRAY[('everyone'::character varying)::text, ('world'::character + varying)::text])) + UNION + SELECT NULL::integer AS "user", + rt.role + FROM role_tags rt + WHERE ((rt.tag)::text = 'world'::text); + + + + + + + + + + + + + SELECT + eur."user", + t.message + FROM effective_user_roles eur, + post_targets t + WHERE (t.target = eur.role) + UNION + SELECT m.owner AS "user", + m.id AS message + FROM posts m; + + + + + + + + + + + + + SELECT + uvp."user", + uvp.message + FROM (user_visible_posts uvp + JOIN bookmarks bm ON ((bm.id = uvp.message))); + + + + + + + + + + + + + + SELECT uvp."user", + uvp.message + FROM (user_visible_posts uvp + JOIN lazychat_messages lm ON ((lm.id = uvp.message))); + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/db/changeLog.xml b/src/main/resources/db/changeLog.xml new file mode 100644 index 0000000..bae8dda --- /dev/null +++ b/src/main/resources/db/changeLog.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/src/main/resources/db/liquibase.properties b/src/main/resources/db/liquibase.properties new file mode 100644 index 0000000..79aca15 --- /dev/null +++ b/src/main/resources/db/liquibase.properties @@ -0,0 +1,3 @@ +url = jdbc:postgresql:///mulkcms?currentSchemas=public,benki +changeLogFile = src/main/resources/db/changeLog.xml +schemas = public,benki -- cgit v1.2.3