Commit 486e30c8b470b49318c87219edbe50de8fbcc4a4

Remove unnecessary notes about foreign keys
timApp/timdb/tim_models.py
(12 / 12)
  
8282 __bind_key__ = 'tim_main'
8383 __tablename__ = 'askedquestion'
8484 asked_id = db.Column(db.Integer, primary_key=True)
85 lecture_id = db.Column(db.Integer, db.ForeignKey('lecture.lecture_id'), nullable=False) # NOTE Added foreign key
86 doc_id = db.Column(db.Integer, db.ForeignKey('block.id')) # NOTE Added foreign key
85 lecture_id = db.Column(db.Integer, db.ForeignKey('lecture.lecture_id'), nullable=False)
86 doc_id = db.Column(db.Integer, db.ForeignKey('block.id'))
8787 par_id = db.Column(db.Text)
8888 asked_time = db.Column(db.DateTime(timezone=True), nullable=False)
8989 points = db.Column(db.Text) # TODO Should possibly be numeric
154154 __tablename__ = 'lecture'
155155 lecture_id = db.Column(db.Integer, primary_key=True)
156156 lecture_code = db.Column(db.Text)
157 doc_id = db.Column(db.Integer, db.ForeignKey('block.id'), nullable=False) # NOTE Added foreign key
158 lecturer = db.Column(db.Integer, db.ForeignKey('useraccount.id'), nullable=False) # NOTE Added foreign key
157 doc_id = db.Column(db.Integer, db.ForeignKey('block.id'), nullable=False)
158 lecturer = db.Column(db.Integer, db.ForeignKey('useraccount.id'), nullable=False)
159159 start_time = db.Column(db.DateTime(timezone=True), nullable=False)
160160 end_time = db.Column(db.DateTime(timezone=True))
161161 password = db.Column(db.Text)
170170 __bind_key__ = 'tim_main'
171171 __tablename__ = 'lectureanswer'
172172 answer_id = db.Column(db.Integer, primary_key=True)
173 user_id = db.Column(db.Integer, db.ForeignKey('useraccount.id'), nullable=False) # NOTE Added foreign key
173 user_id = db.Column(db.Integer, db.ForeignKey('useraccount.id'), nullable=False)
174174 question_id = db.Column(db.Integer, db.ForeignKey('askedquestion.asked_id'),
175 nullable=False) # NOTE Added foreign key
176 lecture_id = db.Column(db.Integer, db.ForeignKey('lecture.lecture_id'), nullable=False) # NOTE Added foreign key
175 nullable=False)
176 lecture_id = db.Column(db.Integer, db.ForeignKey('lecture.lecture_id'), nullable=False)
177177 answer = db.Column(db.Text, nullable=False)
178178 answered_on = db.Column(db.DateTime(timezone=True), nullable=False)
179179 points = db.Column(db.Float)
184184 __tablename__ = 'lectureusers'
185185 lecture_id = db.Column(db.Integer, db.ForeignKey('lecture.lecture_id'), primary_key=True)
186186 user_id = db.Column(db.Integer, db.ForeignKey('useraccount.id'),
187 primary_key=True) # NOTE The foreign key was wrong in schema2
187 primary_key=True)
188188
189189
190190class Message(db.Model):
203203 __bind_key__ = 'tim_main'
204204 __tablename__ = 'question'
205205 question_id = db.Column(db.Integer, primary_key=True)
206 doc_id = db.Column(db.Integer, db.ForeignKey('block.id'), nullable=False) # NOTE Added foreign key
206 doc_id = db.Column(db.Integer, db.ForeignKey('block.id'), nullable=False)
207207 par_id = db.Column(db.Text, nullable=False)
208208 question_title = db.Column(db.Text, nullable=False)
209209 answer = db.Column(db.Text)
216216 __bind_key__ = 'tim_main'
217217 __tablename__ = 'readparagraphs'
218218 usergroup_id = db.Column(db.Integer, primary_key=True)
219 doc_id = db.Column(db.Integer, db.ForeignKey('block.id'), primary_key=True) # NOTE Added foreign key
219 doc_id = db.Column(db.Integer, db.ForeignKey('block.id'), primary_key=True)
220220 par_id = db.Column(db.Text, primary_key=True)
221221 type = db.Column(db.Enum(ReadParagraphType), nullable=False, primary_key=True)
222222 par_hash = db.Column(db.Text, nullable=False)
251251 __bind_key__ = 'tim_main'
252252 __tablename__ = 'usernotes'
253253 id = db.Column(db.Integer, primary_key=True)
254 usergroup_id = db.Column(db.Integer, db.ForeignKey('usergroup.id'), nullable=False) # NOTE Added foreign key
255 doc_id = db.Column(db.Integer, db.ForeignKey('block.id'), nullable=False) # NOTE Added foreign key
254 usergroup_id = db.Column(db.Integer, db.ForeignKey('usergroup.id'), nullable=False)
255 doc_id = db.Column(db.Integer, db.ForeignKey('block.id'), nullable=False)
256256 par_id = db.Column(db.Text, nullable=False)
257257 par_hash = db.Column(db.Text, nullable=False)
258258 content = db.Column(db.Text, nullable=False)