Raise exception if links tables already exists

william/setup-db
William Tran 2 years ago
parent 3035b138f9
commit 9e5bb54eab
  1. 2
      backend/setup_db.py

@ -16,7 +16,7 @@ cur = con.cursor()
# test if table already exists
cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='links'")
if cur.fetchone():
print('Links table already exists.')
raise Exception('Links table already exists.')
else:
cur.execute('''CREATE TABLE links (
url text NOT NULL,

Loading…
Cancel
Save