1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-12-20 23:41:20 +00:00

Fix constraints

This commit is contained in:
Mo 2022-04-18 18:43:55 +02:00
parent f5d6e29664
commit cf0d71325f
2 changed files with 3 additions and 4 deletions

View file

@ -1 +0,0 @@
FLASK_APP=advlabdb

View file

@ -146,7 +146,7 @@ class PartStudent(db.Model):
class Group(db.Model):
id = db.Column(db.Integer, primary_key=True)
number = db.Column(db.Integer, db.CheckConstraint(f"number > {MIN_GROUP_NUMBER}"), nullable=False)
number = db.Column(db.Integer, db.CheckConstraint(f"number >= {MIN_GROUP_NUMBER}"), nullable=False)
semester_id = db.Column(db.Integer, db.ForeignKey("semester.id"), nullable=False)
program_id = db.Column(db.Integer, db.ForeignKey("program.id"), nullable=False)
@ -236,7 +236,7 @@ class GroupExperiment(db.Model):
class Experiment(db.Model):
id = db.Column(db.Integer, primary_key=True)
number = db.Column(db.Integer, db.CheckConstraint(f"number > {MIN_EXPERIMENT_NUMBER}"), nullable=False)
number = db.Column(db.Integer, db.CheckConstraint(f"number >= {MIN_EXPERIMENT_NUMBER}"), nullable=False)
title = db.Column(db.String(200), nullable=False)
description = db.Column(db.Text, nullable=True)
wiki_link = db.Column(db.String(300), nullable=True)
@ -418,7 +418,7 @@ class Appointment(db.Model):
class Part(db.Model):
id = db.Column(db.Integer, primary_key=True)
number = db.Column(db.Integer, db.CheckConstraint(f"number > {MIN_PART_NUMBER}"), nullable=False)
number = db.Column(db.Integer, db.CheckConstraint(f"number >= {MIN_PART_NUMBER}"), nullable=False)
program_id = db.Column(db.Integer, db.ForeignKey("program.id"), nullable=False)
semester_id = db.Column(db.Integer, db.ForeignKey("semester.id"), nullable=False)