~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/database.py

  • Committer: Nick Chadwick
  • Date: 2009-02-20 23:01:15 UTC
  • mto: (1099.1.180 new-dispatch)
  • mto: This revision was merged to the branch mainline in revision 1100.
  • Revision ID: chadnickbok@gmail.com-20090220230115-3siukvo56bu7bcae
Made what should (hopefully) be the last changes to the database schema.

Worksheet_Exercise now has a SERIAL primary key, to deal with a 
limitation in Storm References. Exercise Saves and Attempts now link
to a specific WorksheetExercise, which links a specific worksheet
to an exercise.

This new system should allow us to easily extend it to be 
version-controlled in future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
480
480
 
481
481
class WorksheetExercise(Storm):
482
482
    __storm_table__ = "worksheet_problem"
483
 
    __storm_primary__ = "worksheet_id", "exercise_id"
 
483
    __storm_primary__ = "id"
 
484
    
 
485
    id = Int()
484
486
 
485
487
    worksheet_id = Int(name="worksheetid")
486
488
    worksheet = Reference(worksheet_id, Worksheet.id)
509
511
    __storm_primary__ = "exercise_id", "user_id", "date"
510
512
 
511
513
    exercise_id = Unicode(name="problemid")
512
 
    exercise = Reference(exercise_id, Exercise.id)
513
514
    user_id = Int(name="loginid")
514
515
    user = Reference(user_id, User.id)
515
516
    date = DateTime()
516
517
    text = Unicode()
517
518
    worksheetid = Int()
518
 
    worksheet = Reference(worksheetid, Worksheet.id)
 
519
    worksheet_exercise = ReferenceSet(exercise_id,
 
520
        "WorksheetExercise.exercise_id",
 
521
        "WorksheetExercise.worksheet_id",
 
522
        worksheetid
 
523
    )
519
524
 
520
525
    __init__ = _kwarg_init
521
526