Compare commits
2
Commits
17147307b7
...
412f13692a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
412f13692a | ||
|
|
1477d9ac7f |
@@ -1,2 +1,7 @@
|
|||||||
|
import sqlite3
|
||||||
|
|
||||||
|
from .helpers import create_db
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
print("Hello from cs50-final-project!")
|
db = sqlite3.connect("events")
|
||||||
|
|||||||
@@ -1,9 +1,20 @@
|
|||||||
def create_db(db):
|
import sqlite3
|
||||||
# Create table storing calendar events
|
|
||||||
db.execute("""
|
|
||||||
CREATE TABLE IF NOT EXISTS events (
|
def create_cursor(conn):
|
||||||
name TEXT NOT NULL,
|
cursor = conn.cursor()
|
||||||
description TEXT NOT NULL,
|
cursor.row_factory = sqlite3.Row
|
||||||
time DATETIME NOT NULL
|
return cursor
|
||||||
length INT NOT NULL,);
|
|
||||||
""")
|
def create_db(conn):
|
||||||
|
cursor = create_cursor(conn)
|
||||||
|
cursor.execute("""
|
||||||
|
CREATE TABLE IF NOT EXISTS events
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT
|
||||||
|
name TEXT NOT NULL
|
||||||
|
description TEXT
|
||||||
|
start_time DATETIME NOT NULL
|
||||||
|
length INT NOT NULL
|
||||||
|
all_day BOOL NOT NULL
|
||||||
|
date_created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
|
""");
|
||||||
|
|||||||
Reference in New Issue
Block a user