Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m30s
14 lines
410 B
SQL
14 lines
410 B
SQL
|
|
CREATE TYPE org_role AS ENUM ('owner', 'admin', 'member', 'viewer');
|
|
|
|
CREATE TABLE org_memberships (
|
|
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
org_id UUID NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
|
|
role org_role NOT NULL,
|
|
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
|
|
PRIMARY KEY (user_id, org_id)
|
|
);
|