2022-01-17 22:38:56 +00:00
|
|
|
-- +goose Up
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS groups(
|
|
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
|
group_name TEXT UNIQUE NOT NULL,
|
2022-01-19 21:44:27 +00:00
|
|
|
description TEXT,
|
|
|
|
created_at UNSIGNED BIG INT NOT NULL
|
2022-01-17 22:38:56 +00:00
|
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS articles(
|
2022-01-19 21:44:27 +00:00
|
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
2022-01-17 22:38:56 +00:00
|
|
|
date INTEGER NOT NULL,
|
|
|
|
path TEXT,
|
|
|
|
reply_to TEXT,
|
|
|
|
thread TEXT,
|
|
|
|
subject TEXT NOT NULL,
|
|
|
|
body TEXT NOT NULL
|
|
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS articles_to_groups(
|
2022-01-19 21:44:27 +00:00
|
|
|
article_id INTEGER NOT NULL,
|
2022-01-17 22:38:56 +00:00
|
|
|
group_id INTEGER NOT NULL,
|
|
|
|
FOREIGN KEY (article_id) REFERENCES articles(id) ON DELETE CASCADE,
|
|
|
|
FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE CASCADE
|
|
|
|
);
|
|
|
|
|
|
|
|
-- +goose Down
|
|
|
|
|
|
|
|
DROP TABLE groups;
|
|
|
|
DROP TABLE articles;
|
|
|
|
DROP TABLE articles_to_groups;
|