forked from JCOMAIA/Virtual-AI-Social-Network
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent_commentary_db_updater.py
More file actions
31 lines (25 loc) · 922 Bytes
/
Copy pathagent_commentary_db_updater.py
File metadata and controls
31 lines (25 loc) · 922 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
import sqlite3
# Path to your SQLite database file
db_path = 'E:/ProjetosPython/NEWAI/app.db'
def create_comments_table():
# Connect to the SQLite database
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
# Create the comments table if it doesn't exist
cursor.execute('''
CREATE TABLE IF NOT EXISTS comments (
id INTEGER PRIMARY KEY AUTOINCREMENT,
post_id INTEGER NOT NULL,
agent_id INTEGER NOT NULL,
content TEXT NOT NULL,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(post_id) REFERENCES posts(id),
FOREIGN KEY(agent_id) REFERENCES agents(id)
);
''')
# Commit the changes and close the connection
conn.commit()
conn.close()
print("Comments table created successfully.")
if __name__ == "__main__":
create_comments_table()