Skip to content

Commit

Permalink
Add users table
Browse files Browse the repository at this point in the history
* Add users table

Closes #5 and #6.

* Fix workflow?

* fix type issues

* Collapse Zapatos generated types in PR reviews

* Don't allow multiple roles

---------

Co-authored-by: Anup Mantri <[email protected]>
  • Loading branch information
codetheweb and amantri authored Feb 20, 2023
1 parent c2d3def commit a2ed125
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 52 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Collapse Zapatos generated types in GitHub PR reviews
schema.d.ts linguist-generated
15 changes: 12 additions & 3 deletions server/src/db/migrations/1_initial-migrations.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
CREATE TABLE student (
student_id SERIAL PRIMARY KEY,
CREATE EXTENSION "uuid-ossp";

CREATE TABLE "user" (
user_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
first_name TEXT NOT NULL,
last_name TEXT NOT NULL,
birth_year INT NOT NULL
role TEXT NOT NULL CHECK (role IN ('para', 'case_manager', 'admin'))
);

CREATE TABLE "student" (
student_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
first_name TEXT NOT NULL,
last_name TEXT NOT NULL,
assigned_case_manager_id UUID REFERENCES "user" (user_id) ON DELETE SET NULL
);
241 changes: 196 additions & 45 deletions server/src/db/zapatos/schema.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a2ed125

Please sign in to comment.