Refactored to use PostgreSQL. #9
|
@ -5,7 +5,9 @@ CREATE TABLE classroom_compliance_class (
|
||||||
school_year VARCHAR(9) NOT NULL,
|
school_year VARCHAR(9) NOT NULL,
|
||||||
user_id BIGINT NOT NULL
|
user_id BIGINT NOT NULL
|
||||||
REFERENCES auth_user(id)
|
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 (
|
CREATE TABLE classroom_compliance_student (
|
||||||
|
@ -36,5 +38,7 @@ CREATE TABLE classroom_compliance_entry (
|
||||||
CONSTRAINT absence_nulls_check CHECK (
|
CONSTRAINT absence_nulls_check CHECK (
|
||||||
(absent AND phone_compliant IS NULL AND behavior_rating IS NULL) OR
|
(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)
|
(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)
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=teacher-tools-api
|
Description=teacher-tools-api
|
||||||
After=network.target
|
After=network.target postgresql.service
|
||||||
|
Wants=postgresql.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=root
|
User=root
|
||||||
WorkingDirectory=/opt/teacher-tools
|
WorkingDirectory=/opt/teacher-tools
|
||||||
Environment="TEACHER_TOOLS_API_ENV=PROD"
|
EnvironmentFile=/opt/teacher-tools/prod.env
|
||||||
ExecStart=/opt/teacher-tools/teacher-tools-api
|
ExecStart=/opt/teacher-tools/teacher-tools-api
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue