-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_notifications.py
More file actions
37 lines (29 loc) · 1.06 KB
/
Copy pathsetup_notifications.py
File metadata and controls
37 lines (29 loc) · 1.06 KB
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
35
36
37
#!/usr/bin/env python3
"""Setup script for notifications system."""
import psycopg2
import logging
from job_search_storage import DB_CONFIG
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def setup_notifications_database():
"""Create notifications database tables."""
try:
# Read the schema file
with open('create_notifications_schema.sql', 'r') as f:
schema_sql = f.read()
# Connect to database
conn = psycopg2.connect(**DB_CONFIG)
conn.autocommit = True
cursor = conn.cursor()
# Execute schema creation
cursor.execute(schema_sql)
logger.info("✅ Notifications database schema created successfully")
cursor.close()
conn.close()
except Exception as e:
logger.error(f"❌ Error setting up notifications database: {e}")
raise
if __name__ == "__main__":
print("Setting up notifications database...")
setup_notifications_database()
print("✅ Notifications setup complete!")