From a96867d1b9e6a753dcf2fd5dcc02d945f9f0330a Mon Sep 17 00:00:00 2001 From: Mitchell Marino Date: Tue, 11 Apr 2023 22:53:07 -0500 Subject: [PATCH] updated migrations --- migrations/20230402213003_user.sql | 6 ++++-- migrations/20230405224136_events.sql | 13 +++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/migrations/20230402213003_user.sql b/migrations/20230402213003_user.sql index 15c19dc..0cdb507 100644 --- a/migrations/20230402213003_user.sql +++ b/migrations/20230402213003_user.sql @@ -1,6 +1,8 @@ +CREATE TYPE role AS ENUM ('student', 'teacher', 'admin'); + CREATE TABLE users ( id SERIAL PRIMARY KEY, + role role NOT NULL, username varchar(255) UNIQUE NOT NULL, - password bytea + password bytea NOT NULL ); - diff --git a/migrations/20230405224136_events.sql b/migrations/20230405224136_events.sql index 1df945a..3f57dba 100644 --- a/migrations/20230405224136_events.sql +++ b/migrations/20230405224136_events.sql @@ -2,13 +2,14 @@ CREATE TYPE event_type AS ENUM ('sports', 'meetings', 'drama', 'music', 'other') CREATE TABLE events ( id SERIAL PRIMARY KEY, - title VARCHAR(255), - time_start TIMESTAMP, - time_end TIMESTAMP, - event_type event_type, - points INTEGER, + description TEXT NOT NULL, + title VARCHAR(255) NOT NULL, + time_start TIMESTAMP NOT NULL, + time_end TIMESTAMP NOT NULL, + event_type event_type NOT NULL, + points INTEGER NOT NULL, place VARCHAR(255), - price DECIMAL(10, 2), + price DECIMAL(10, 2) NOT NULL, created_by INTEGER REFERENCES users(id) );