(feat): Init concept of coming soon landing page
This commit is contained in:
24
database.py
Normal file
24
database.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import sqlite3
|
||||
|
||||
def init_db():
|
||||
conn = sqlite3.connect('subscribers.db')
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS subscribers (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
email TEXT UNIQUE NOT NULL
|
||||
)
|
||||
""")
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
def add_email(email):
|
||||
try:
|
||||
conn = sqlite3.connect('subscribers.db')
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("INSERT INTO subscribers (email) VALUES (?)", (email,))
|
||||
conn.commit()
|
||||
conn.close()
|
||||
return True
|
||||
except sqlite3.IntegrityError:
|
||||
return False
|
||||
Reference in New Issue
Block a user