Adapt DB layout to multiple authors and contributors
This commit is contained in:
parent
485eaaca70
commit
eb8e14ff6d
@ -30,7 +30,6 @@ CREATE TABLE articles (
|
||||
summary TEXT NOT NULL,
|
||||
published BOOL NOT NULL,
|
||||
rejected BOOL NOT NULL,
|
||||
author_id INT NOT NULL,
|
||||
issue_id INT NOT NULL,
|
||||
edited_id INT,
|
||||
is_in_issue BOOL NOT NULL,
|
||||
@ -46,6 +45,22 @@ CREATE TABLE tags (
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE articles_authors (
|
||||
article_id INT,
|
||||
author_id INT,
|
||||
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,
|
||||
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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user