This project provides a PostgreSQL database setup script for the Homework Hub application. The database is named homework_hub and supports managing student assignments, reminders, and study sessions.
- Creates the
homework_hubdatabase. - Defines the schema with tables for:
- Students
- Assignments
- Reminders
- Study Sessions
- Includes default configurations to streamline setup.
Before running the script, ensure the following:
- Python 3 is installed.
- PostgreSQL is installed and running.
- You have administrative access to PostgreSQL.
Clone this repository to your local machine:
git clone https://github.com/yourusername/homework-hub-db.git
cd homework-hub-dbInstall the Python dependencies using pip:
pip install psycopg2Execute the create_homework_hub_db.py script to create the homework_hub database:
python create_homework_hub_db.pyThe script will prompt for the PostgreSQL password for the default postgres user:
Enter the PostgreSQL password for user 'postgres': your_password
Execute the LhhCode.py to use the program to track your homework, study sessions and reminders:
python LhhCode.pyThe homework_hub database includes the following tables:
| Column | Type | Description |
|---|---|---|
student_id |
SERIAL |
Primary key |
full_name |
VARCHAR(100) |
Full name of the student |
email |
VARCHAR(100) |
Email address (unique identifier) |
| Column | Type | Description |
|---|---|---|
assignment_id |
SERIAL |
Primary key |
task_name |
VARCHAR(255) |
Name of the assignment |
due_date |
DATE |
Due date of the assignment |
subject |
VARCHAR(100) |
Subject associated with the assignment |
priority_level |
INT |
Priority level (1-5) |
student_id |
INT |
Foreign key referencing student_id |
| Column | Type | Description |
|---|---|---|
reminder_id |
SERIAL |
Primary key |
date |
DATE |
Date of the reminder |
assignment_id |
INT |
Foreign key referencing assignment_id |
| Column | Type | Description |
|---|---|---|
session_id |
SERIAL |
Primary key |
start_time |
TIMESTAMP |
Start time of the study session |
end_time |
TIMESTAMP |
End time of the study session |
notes |
TEXT |
Notes about the study session |
subject |
VARCHAR(100) |
Subject associated with the session |
Database 'homework_hub' created successfully.Database 'homework_hub' already exists.-
Error:
could not connect to server- Ensure PostgreSQL is running and accessible at
localhost:5432.
- Ensure PostgreSQL is running and accessible at
-
Error:
FATAL: password authentication failed for user "postgres"- Check the entered password. Ensure it matches the PostgreSQL configuration.
-
Error:
psycopg2.errors.DuplicateDatabase- The database already exists. You can connect to it directly.