diff --git a/doc/db2/01_schema/03_articles.sql b/doc/db2/01_schema/03_articles.sql index 732cb14b..e59294a3 100644 --- a/doc/db2/01_schema/03_articles.sql +++ b/doc/db2/01_schema/03_articles.sql @@ -11,25 +11,25 @@ create table if not exists article_revisions( changelog varchar(255), title1 varchar(512), - title1_lang varchar(12) default 'english', + title1_lang varchar(12) not null default 'english', title2 varchar(512), - title2_lang varchar(12) default 'english', + title2_lang varchar(12) not null default 'english', title3 varchar(512), - title3_lang varchar(12) default 'english', + title3_lang varchar(12) not null default 'english', title4 varchar(512), - title4_lang varchar(12) default 'english', + title4_lang varchar(12) not null default 'english', title5 varchar(512), - title5_lang varchar(12) default 'english', + title5_lang varchar(12) not null default 'english', title6 varchar(512), - title6_lang varchar(12) default 'english', + title6_lang varchar(12) not null default 'english', title7 varchar(512), - title7_lang varchar(12) default 'english', + title7_lang varchar(12) not null default 'english', teaser varchar(512), - teaser_lang varchar(12) default 'german', + teaser_lang varchar(12) not null default 'german', content varchar(16384), - content_lang varchar(12) default 'german' + content_lang varchar(12) not null default 'german' ); -- Artikel diff --git a/src/main/java/de/holarse/queues/consumers/ArticleImportWorker.java b/src/main/java/de/holarse/queues/consumers/ArticleImportWorker.java index 55dfaa57..891d44f6 100644 --- a/src/main/java/de/holarse/queues/consumers/ArticleImportWorker.java +++ b/src/main/java/de/holarse/queues/consumers/ArticleImportWorker.java @@ -53,16 +53,25 @@ public void importArticles(final de.holarse.backend.api.Article queueEntry) { for (final Title title : queueEntry.getTitles()) { i++; switch (i) { - case 1 -> { articleRevision.setTitle1(title.getValue()); articleRevision.setTitle1Lang("german"); } - case 2 -> { articleRevision.setTitle2(title.getValue()); articleRevision.setTitle2Lang("german"); } - case 3 -> { articleRevision.setTitle3(title.getValue()); articleRevision.setTitle3Lang("german"); } - case 4 -> { articleRevision.setTitle4(title.getValue()); articleRevision.setTitle4Lang("german"); } - case 5 -> { articleRevision.setTitle5(title.getValue()); articleRevision.setTitle5Lang("german"); } - case 6 -> { articleRevision.setTitle6(title.getValue()); articleRevision.setTitle6Lang("german"); } - case 7 -> { articleRevision.setTitle7(title.getValue()); articleRevision.setTitle7Lang("german"); } + case 1 -> articleRevision.setTitle1(title.getValue()); + case 2 -> articleRevision.setTitle2(title.getValue()); + case 3 -> articleRevision.setTitle3(title.getValue()); + case 4 -> articleRevision.setTitle4(title.getValue()); + case 5 -> articleRevision.setTitle5(title.getValue()); + case 6 -> articleRevision.setTitle6(title.getValue()); + case 7 -> articleRevision.setTitle7(title.getValue()); default -> log.warn("Too many titles (>7) in this article, ignoring the rest"); } } + + articleRevision.setTitle1Lang("english"); + articleRevision.setTitle2Lang("english"); + articleRevision.setTitle3Lang("english"); + articleRevision.setTitle4Lang("english"); + articleRevision.setTitle5Lang("english"); + articleRevision.setTitle6Lang("english"); + articleRevision.setTitle7Lang("english"); + articleRevision.setContent(queueEntry.getContent().getValue()); articleRevision.setNodeId(nodeId); articleRevision.setRevision(revision);