Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #46 from colincoghill/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
colincoghill committed Jul 10, 2013
2 parents dea11c6 + 2a7e553 commit ac44c25
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
28 changes: 18 additions & 10 deletions bin/oasisdb
Original file line number Diff line number Diff line change
Expand Up @@ -161,29 +161,36 @@ def calc_stats(DB):
Stats.do_initial_stats_update()


def upgrade_3_6_to_3_9_2(DB):
""" Given a 3.6 database, upgrade it to 3.9.2.
def upgrade_3_6_to_3_9_3(DB):
""" Given a 3.6 database, upgrade it to 3.9.3
"""
with open(os.path.join(APPDIR, "deploy", "migrate_36x_to_392.sql")) as f:
sql = f.read()

DB.run_sql(sql)
print "Migrated table structure from 3.6 to 3.9.2"
calc_stats(DB)
with open(os.path.join(APPDIR, "deploy", "migrate_392_to_393.sql")) as f:
sql = f.read()
DB.run_sql(sql)
print "Migrated table structure from 3.9.2 to 3.9.3"
if not options.noresetadmin:
generate_admin_passwd(DB)
generate_admin_passwd(DB) # 3.6 passwords were in a slightly less secure format


def upgrade_3_9_1_to_3_9_2(DB):
def upgrade_3_9_1_to_3_9_3(DB):
""" Given a 3.9.1 database, upgrade it to 3.9.2.
"""
with open(os.path.join(APPDIR, "deploy", "migrate_391_to_392.sql")) as f:
sql = f.read()

DB.run_sql(sql)
print "Migrated table structure from 3.9.1 to 3.9.2"
if not options.noresetadmin:
generate_admin_passwd(DB)

with open(os.path.join(APPDIR, "deploy", "migrate_392_to_393.sql")) as f:
sql = f.read()
DB.run_sql(sql)
print "Migrated table structure from 3.9.2 to 3.9.3"


def upgrade_3_9_2_to_3_9_3(DB):
Expand All @@ -194,8 +201,6 @@ def upgrade_3_9_2_to_3_9_3(DB):

DB.run_sql(sql)
print "Migrated table structure from 3.9.2 to 3.9.3"
if not options.noresetadmin:
generate_admin_passwd(DB)


def clean_install_3_6(DB):
Expand Down Expand Up @@ -406,6 +411,9 @@ def do_init(DB, options):
elif options.oaver == '3.9.2':
erase_existing(DB) # might be some dregs, like sequences or views
clean_install_3_9_2(DB)
elif options.oaver == '3.9.3':
erase_existing(DB) # might be some dregs, like sequences or views
clean_install_3_9_3(DB)
else:
print "Unknown database version (%s)" % (options.oaver,)
print "Available options: 3.6 3.9.1 3.9.2 3.9.3"
Expand Down Expand Up @@ -467,10 +475,10 @@ def do_upgrade(DB, options):

dbver = DB.get_db_version()
if dbver == "3.6":
upgrade_3_6_to_3_9_2(DB)
upgrade_3_6_to_3_9_3(DB)
sys.exit()
if dbver == "3.9.1":
upgrade_3_9_1_to_3_9_2(DB)
upgrade_3_9_1_to_3_9_3(DB)
sys.exit()
if dbver == "3.9.2":
upgrade_3_9_2_to_3_9_3(DB)
Expand Down
4 changes: 0 additions & 4 deletions deploy/migrate_36x_to_392.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ ALTER TABLE courses ADD COLUMN "assess_visibility" character varying DEFAULT 'en
ALTER TABLE exams ADD COLUMN "code" character varying;
ALTER TABLE exams ADD COLUMN "instant" integer;

ALTER TABLE users ADD COLUMN "email" character varying;
ALTER TABLE users ADD COLUMN "source" character varying;
ALTER TABLE users ADD COLUMN "expiry" timestamp with time zone;

ALTER TABLE users ADD COLUMN "confirmed" character varying;
ALTER TABLE users ADD COLUMN "confirmation_code" character varying;
ALTER TABLE users ALTER COLUMN "passwd" TYPE character varying;
Expand Down
2 changes: 1 addition & 1 deletion src/templates/cadmin_examresults.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h4>{{ group.title }}</h4>
<td>{{ users[user_id]['uname'] }}</td>
<td>{{ users[user_id]['familyname'] }}</td>
<td>{{ users[user_id]['givenname'] }}</td>
<td>{{ users[user_id]['studentid'] }}</td>
<td>{{ users[user_id]['student_id'] }}</td>

{% for question in questions %}
<td>
Expand Down

0 comments on commit ac44c25

Please sign in to comment.