This commit is contained in:
@@ -112,10 +112,16 @@ CREATE INDEX IF NOT EXISTS protocols_user_id_idx ON protocols(user_id);
|
||||
-- User profile — lab defaults pre-filled on chemical entries
|
||||
CREATE TABLE IF NOT EXISTS user_profile (
|
||||
user_id TEXT NOT NULL PRIMARY KEY REFERENCES "user"("id") ON DELETE CASCADE,
|
||||
pi_first_name TEXT NOT NULL,
|
||||
bldg_code TEXT NOT NULL,
|
||||
lab TEXT NOT NULL,
|
||||
pi_first_name TEXT,
|
||||
bldg_code TEXT,
|
||||
lab TEXT,
|
||||
contact TEXT,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Allow existing deployments to have nullable profile fields.
|
||||
-- DROP NOT NULL on an already-nullable column is a no-op in Postgres.
|
||||
ALTER TABLE user_profile ALTER COLUMN pi_first_name DROP NOT NULL;
|
||||
ALTER TABLE user_profile ALTER COLUMN bldg_code DROP NOT NULL;
|
||||
ALTER TABLE user_profile ALTER COLUMN lab DROP NOT NULL;
|
||||
|
||||
Reference in New Issue
Block a user