From bc448be5c8e23fed843ddba6135af3491d001b9b Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 16 Nov 2019 08:55:54 +0000 Subject: WIP --- guix-data-service/jobs/load-new-guix-revision.scm | 3 ++ guix-data-service/model/channel-news.scm | 10 ++++++ sqitch/deploy/channel_news_tables.sql | 38 +++++++++++++++++++++++ sqitch/revert/channel_news_tables.sql | 7 +++++ sqitch/sqitch.plan | 1 + sqitch/verify/channel_news_tables.sql | 7 +++++ 6 files changed, 66 insertions(+) create mode 100644 guix-data-service/model/channel-news.scm create mode 100644 sqitch/deploy/channel_news_tables.sql create mode 100644 sqitch/revert/channel_news_tables.sql create mode 100644 sqitch/verify/channel_news_tables.sql diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index c56e897..e21764e 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -1044,6 +1044,9 @@ ORDER BY packages.name, packages.version" channel-for-commit)))) (if store-item (and + (peek (channel-news-for-commit channel-for-commit + commit)) + (error "foo") (extract-information-from conn git-repository-id commit store-item) (update-package-versions-table conn git-repository-id commit) diff --git a/guix-data-service/model/channel-news.scm b/guix-data-service/model/channel-news.scm new file mode 100644 index 0000000..985737d --- /dev/null +++ b/guix-data-service/model/channel-news.scm @@ -0,0 +1,10 @@ + + + + + + + +(define (channel-news-entries->channel-new-entry-ids channel-news-entries) + ) + diff --git a/sqitch/deploy/channel_news_tables.sql b/sqitch/deploy/channel_news_tables.sql new file mode 100644 index 0000000..7dbf32e --- /dev/null +++ b/sqitch/deploy/channel_news_tables.sql @@ -0,0 +1,38 @@ +-- Deploy guix-data-service:channel_news_tables to pg + +BEGIN; + +CREATE TABLE channel_news_entries ( + id integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY, + commit varchar, + tag varchar +); + +CREATE TABLE guix_revision_channel_news_entries ( + guix_revision_id integer NOT NULL REFERENCES guix_revisions (id), + channel_news_entry_id integer NOT NULL REFERENCES channel_news_entries (id), + PRIMARY KEY (guix_revision_id, channel_news_entry_id) +); + +CREATE TABLE channel_news_entry_text ( + id integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY, + lang varchar NOT NULL, + text varchar NOT NULL, + UNIQUE (lang, text) +); + +CREATE TABLE channel_news_entry_titles ( + channel_news_entry_id + integer NOT NULL REFERENCES channel_news_entries (id), + channel_news_entry_text_id + integer NOT NULL REFERENCES channel_news_entry_text (id) +); + +CREATE TABLE channel_news_entry_bodies ( + channel_news_entry_id + integer NOT NULL REFERENCES channel_news_entries (id), + channel_news_entry_text_id + integer NOT NULL REFERENCES channel_news_entry_text (id) +); + +COMMIT; diff --git a/sqitch/revert/channel_news_tables.sql b/sqitch/revert/channel_news_tables.sql new file mode 100644 index 0000000..fd2a548 --- /dev/null +++ b/sqitch/revert/channel_news_tables.sql @@ -0,0 +1,7 @@ +-- Revert guix-data-service:channel_news_tables from pg + +BEGIN; + +-- XXX Add DDLs here. + +COMMIT; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index ec87d46..027d337 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -26,3 +26,4 @@ fix_null_values_in_git_branches 2019-09-29T11:06:12Z Christopher Baines # Add retry value to job_event enum remove_guix_revision_duplicates 2019-10-05T08:00:14Z Christopher Baines # Remove duplicates in the guix_revisions table package_derivations_by_guix_revision_range 2019-11-09T19:09:48Z Christopher Baines # Add package_derivations_by_guix_revision_range +channel_news_tables 2019-11-15T07:32:07Z Christopher Baines # Add tables to store channel news diff --git a/sqitch/verify/channel_news_tables.sql b/sqitch/verify/channel_news_tables.sql new file mode 100644 index 0000000..3317b4d --- /dev/null +++ b/sqitch/verify/channel_news_tables.sql @@ -0,0 +1,7 @@ +-- Verify guix-data-service:channel_news_tables on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; -- cgit v1.2.3