-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase_setup.py
More file actions
34 lines (27 loc) · 814 Bytes
/
Copy pathdatabase_setup.py
File metadata and controls
34 lines (27 loc) · 814 Bytes
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
from command_processing import update_user_points, add_user_to_database
def test_update_points():
update_user_points('Balls', 70)
print("Test update complete.")
def create_tables():
conn = sqlite3.connect('points.db') # Connect to the points.db database
cursor = conn.cursor()
# Create users table
cursor.execute('''
CREATE TABLE IF NOT EXISTS users (
username TEXT PRIMARY KEY
)
''')
# Create user_points table
cursor.execute('''
CREATE TABLE IF NOT EXISTS user_points (
username TEXT PRIMARY KEY,
points INTEGER NOT NULL
)
''')
conn.commit()
conn.close()
if __name__ == "__main__":
create_tables()
add_user_to_database("Balls")
test_update_points()