-
Notifications
You must be signed in to change notification settings - Fork 32
/
setup.py
34 lines (25 loc) · 783 Bytes
/
setup.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
import sqlite3
import sys
# ---------------------------------------
# Safety lock: make sure they know what they're doing.
# Override by giving -y as an argument.
if '-y' not in sys.argv:
safety = ''
while safety.lower() != 'y':
safety = input("WARNING: This will erase the current database! \nDo you want to proceed? [Y/n] ")
if safety.lower() == 'n':
exit()
# ---------------------------------------
# Reset the database
with open('links.db', 'w') as open_file:
pass
conn = sqlite3.connect('links.db')
c = conn.cursor()
c.execute("""CREATE TABLE "links" (
"link" TEXT NOT NULL,
"visits" INTEGER NOT NULL DEFAULT 0,
"title" TEXT NOT NULL,
"description" TEXT,
"image" TEXT,
PRIMARY KEY("link")
);""")