Commit b652144b authored by Robert Czechowski's avatar Robert Czechowski
Browse files

Add initial database migrations for PostgreSQL

parent e2304146
CREATE TABLE contest (
id SERIAL PRIMARY KEY,
location TEXT NOT NULL,
filename TEXT NOT NULL,
name TEXT NOT NULL,
duration INTEGER NOT NULL,
public BOOL NOT NULL,
start_date TIMESTAMP,
end_date TIMESTAMP
)
CREATE TABLE grade (
taskgroup INTEGER,
session INTEGER,
grade INTEGER,
validated BOOL,
PRIMARY KEY (taskgroup, session)
)
CREATE TABLE usergroup (
id SERIAL PRIMARY KEY,
name TEXT,
groupcode TEXT,
tag TEXT,
admin INTEGER
)
CREATE TABLE participation (
contest INTEGER,
session INTEGER,
start_date TIMESTAMP,
PRIMARY KEY (contest, session)
)
CREATE TABLE session (
id SERIAL PRIMARY KEY,
session_token TEXT,
csrf_token TEXT,
last_login TIMESTAMP,
last_activity TIMESTAMP,
permanent_login BOOL,
username TEXT,
password TEXT,
salt TEXT,
logincode TEXT,
email TEXT,
email_unconfirmed TEXT,
email_confirmationcode TEXT,
firstname TEXT,
lastname TEXT,
street TEXT,
zip TEXT,
city TEXT,
nation TEXT,
grade INTEGER,
is_teacher BOOL,
managed_by INTEGER,
oauth_foreign_id TEXT,
oauth_provider TEXT
)
CREATE TABLE submission (
id SERIAL PRIMARY KEY,
session INTEGER NOT NULL,
task INTEGER NOT NULL,
grade INTEGER NOT NULL,
validated BOOL NOT NULL,
needs_validation BOOL NOT NULL,
nonvalidated_grade INTEGER NOT NULL,
subtask_identifier TEXT,
value TEXT,
date TIMESTAMP
)
CREATE TABLE task (
id SERIAL PRIMARY KEY,
taskgroup INTEGER,
location TEXT,
stars INTEGER
)
CREATE TABLE taskgroup (
id SERIAL PRIMARY KEY,
contest INTEGER NOT NULL,
name TEXT NOT NULL
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment