From 523bdb24cd9eee4a4641e5197d32c522b05d6060 Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Fri, 27 Dec 2024 10:53:06 +0100 Subject: [PATCH] Cleanup --- cmd/frontend/articles.go | 1 + create_db.sql | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cmd/frontend/articles.go b/cmd/frontend/articles.go index 5d768a3..7610777 100644 --- a/cmd/frontend/articles.go +++ b/cmd/frontend/articles.go @@ -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 { diff --git a/create_db.sql b/create_db.sql index 4ad9067..a79e89c 100644 --- a/create_db.sql +++ b/create_db.sql @@ -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)