Refactored to use PostgreSQL. #9

Merged
andrew merged 3 commits from postgres-migration into master 2025-01-24 00:39:39 +00:00
2 changed files with 9 additions and 4 deletions
Showing only changes of commit 620fd94f8f - Show all commits

View File

@ -5,7 +5,9 @@ CREATE TABLE classroom_compliance_class (
school_year VARCHAR(9) NOT NULL,
user_id BIGINT NOT NULL
REFERENCES auth_user(id)
ON UPDATE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT unique_class_numbers_per_school_year
UNIQUE(number, school_year, user_id)
);
CREATE TABLE classroom_compliance_student (
@ -36,5 +38,7 @@ CREATE TABLE classroom_compliance_entry (
CONSTRAINT absence_nulls_check CHECK (
(absent AND phone_compliant IS NULL AND behavior_rating IS NULL) OR
(NOT absent AND phone_compliant IS NOT NULL AND behavior_rating IS NOT NULL)
)
),
CONSTRAINT unique_entry_per_date
UNIQUE(class_id, student_id, date)
);

View File

@ -1,12 +1,13 @@
[Unit]
Description=teacher-tools-api
After=network.target
After=network.target postgresql.service
Wants=postgresql.service
[Service]
Type=simple
User=root
WorkingDirectory=/opt/teacher-tools
Environment="TEACHER_TOOLS_API_ENV=PROD"
EnvironmentFile=/opt/teacher-tools/prod.env
ExecStart=/opt/teacher-tools/teacher-tools-api
Restart=always