-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
36 lines (32 loc) · 860 Bytes
/
schema.sql
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
31
32
33
34
35
36
DROP TABLE IF EXISTS author;
DROP TABLE IF EXISTS post;
DROP TABLE IF EXISTS tpcnx;
DROP TABLE IF EXISTS weights;
CREATE TABLE author (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT UNIQUE NOT NULL
);
CREATE TABLE post (
id INTEGER PRIMARY KEY AUTOINCREMENT,
author_id INTEGER NOT NULL,
title TEXT NOT NULL,
body_formatted TEXT NOT NULL,
published TEXT NOT NULL,
FOREIGN KEY (author_id) REFERENCES author (id)
);
CREATE TABLE tpcnx (
id INTEGER PRIMARY KEY AUTOINCREMENT,
tag_id INTEGER NOT NULL,
post_id INTEGER NOT NULL,
user_conf INTEGER,
weight REAL,
FOREIGN KEY (tag_id) REFERENCES tags (id),
FOREIGN KEY (post_id) REFERENCES post (id)
);
CREATE TABLE tags (
id INTEGER PRIMARY KEY AUTOINCREMENT,
tag TEXT NOT NULL,
best_token TEXT NOT NULL,
count INTEGER,
idf REAL
);