Adds python file to setup database

This commit is contained in:
William 2021-03-07 22:51:35 -05:00
parent 23a1afd098
commit 2e1344d49a
2 changed files with 21 additions and 1 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
venv
links.db

19
backend/setup_db.py Normal file
View File

@ -0,0 +1,19 @@
import sqlite3
con = sqlite3.connect('links.db')
# array of links to store
links = [
('http://csclub.uwaterloo.ca/','CS Club Website',3,1),
('https://www.instagram.com/uwcsclub/','Instagram',4,1),
('https://www.facebook.com/uw.computerscienceclub','Facebook',5,0),
('http://twitch.tv/uwcsclub','Twitch',6,0),
('http://bit.ly/uwcsclub-yt','YouTube',7,1),
]
# SQLite setup
cur = con.cursor()
cur.execute("CREATE TABLE links (url text, name text, clicks int, active int)")
cur.executemany("INSERT INTO links VALUES (?,?,?,?)", links)
con.commit()
con.close()