This repository has been archived by the owner on Mar 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconst.py
63 lines (49 loc) · 1.82 KB
/
const.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
MAIN_DECK_ID = 0
DB_NAME = 'dummy.db'
STUB_NAME = "stub.db"
PURGE_STUB_SCRIPT = """\
BEGIN TRANSACTION;
DELETE FROM Deck;
DELETE FROM Card;
END TRANSACTION;
"""
CREATE_STUB_SCRIPT = """\
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS Deck(
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
parent_id INTEGER,
FOREIGN KEY(parent_id) REFERENCES Deck(id)
);
CREATE TABLE IF NOT EXISTS Card(
id INTEGER PRIMARY KEY,
EF REAL NOT NULL,
front TEXT NOT NULL,
back TEXT NOT NULL,
due INTEGER NOT NULL,
last_interval INTEGER,
deck_id INTEGER,
FOREIGN KEY(deck_id) REFERENCES Deck(id)
);
INSERT INTO deck VALUES (0, 'main', NULL);
INSERT INTO deck VALUES (1, 'prog-langs', 0);
INSERT INTO deck VALUES (2, 'Python', 1);
INSERT INTO deck VALUES (3, 'C', 1);
INSERT INTO card (front, back, ef, due, last_interval, deck_id) VALUES
('general question 1', 'general answer 1', 2.5, 12345, 6, 1);
INSERT INTO card (front, back, ef, due, last_interval, deck_id) VALUES
('general question 2', 'general answer 2', 2.5, 10000, 54, 1);
INSERT INTO card (front, back, ef, due, last_interval, deck_id) VALUES
('Python question 1', 'Python answer 1', 1.5, 6542, 98, 2);
INSERT INTO card (front, back, ef, due, last_interval, deck_id) VALUES
('Python question 2', 'Python answer 2', 1.5, 6542, 98, 2);
INSERT INTO card (front, back, ef, due, last_interval, deck_id) VALUES
('Python question 3', 'Python answer 3', 1.5, 6542, 98, 2);
INSERT INTO card (front, back, ef, due, last_interval, deck_id) VALUES
('C question 1', 'C answer 1', 1.2, 6542, 98, 2);
INSERT INTO card (front, back, ef, due, last_interval, deck_id) VALUES
('C question 2', 'C answer 2', 1.2, 6542, 98, 2);
INSERT INTO card (front, back, ef, due, last_interval, deck_id) VALUES
('C question 3', 'C answer 3', 1.2, 6542, 98, 2);
END TRANSACTION;
"""