aboutsummaryrefslogtreecommitdiffstats
path: root/mysql.init.sql
blob: dbbc310d7c1e967d72f963cae0d6bf6ef484e997 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
SET NAMES 'utf8mb4';
SET CHARACTER SET utf8mb4;

CREATE TABLE feed (
  id INT NOT NULL AUTO_INCREMENT,
  url VARCHAR(255) NOT NULL,
  web_url VARCHAR(255) NOT NULL DEFAULT "",
  title VARCHAR(255) NOT NULL DEFAULT "",
  category VARCHAR(255) NOT NULL DEFAULT "uncategorized",
  last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  UNIQUE KEY (url),
  PRIMARY KEY (id)
);

CREATE TABLE item (
  id INT NOT NULL AUTO_INCREMENT,
  feed_id INT NOT NULL,
  title TEXT NOT NULL DEFAULT "",
  url VARCHAR(255) NOT NULL,
  description TEXT NOT NULL DEFAULT "",
  full_content TEXT NOT NULL DEFAULT "",
  header_image TEXT NOT NULL DEFAULT "",
  publish_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
  read_state BOOLEAN DEFAULT FALSE NOT NULL,
  starred BOOLEAN DEFAULT FALSE NOT NULL,
  FOREIGN KEY (feed_id) REFERENCES feed(id) ON DELETE CASCADE,
  UNIQUE KEY (url),
  INDEX (publish_date),
  PRIMARY KEY (id)
);