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 --- 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 + 4 files changed, 1178 insertions(+), 4 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 (limited to 'src/main') 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