This commit is contained in:
Jason Streifling 2024-12-27 10:53:06 +01:00
parent 376a1264f5
commit 523bdb24cd
2 changed files with 8 additions and 7 deletions

View File

@ -121,6 +121,7 @@ func SubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
Rejected: false,
IsInIssue: r.PostFormValue("issue") == "on",
AutoGenerated: false,
EditedID: 0,
}
if len(article.Title) == 0 {

View File

@ -34,7 +34,7 @@ CREATE TABLE articles (
rejected BOOL NOT NULL,
creator_id INT NOT NULL,
issue_id INT NOT NULL,
edited_id INT,
edited_id INT NOT NULL,
clicks INT NOT NULL,
is_in_issue BOOL NOT NULL,
auto_generated BOOL NOT NULL,
@ -50,24 +50,24 @@ CREATE TABLE tags (
);
CREATE TABLE articles_authors (
article_id INT,
author_id INT,
article_id INT NOT NULL,
author_id INT NOT NULL,
PRIMARY KEY (article_id, author_id),
FOREIGN KEY (article_id) REFERENCES articles (id),
FOREIGN KEY (author_id) REFERENCES users (id)
);
CREATE TABLE articles_contributors (
article_id INT,
contributor_id INT,
article_id INT NOT NULL,
contributor_id INT NOT NULL,
PRIMARY KEY (article_id, contributor_id),
FOREIGN KEY (article_id) REFERENCES articles (id),
FOREIGN KEY (contributor_id) REFERENCES users (id)
);
CREATE TABLE articles_tags (
article_id INT,
tag_id INT,
article_id INT NOT NULL,
tag_id INT NOT NULL,
PRIMARY KEY (article_id, tag_id),
FOREIGN KEY (article_id) REFERENCES articles (id),
FOREIGN KEY (tag_id) REFERENCES tags (id)