Files
geo/server/migrations/20260331100003_create_platform_user_roles.up.sql
T

10 lines
435 B
SQL
Raw Normal View History

CREATE TABLE platform_user_roles (
id BIGSERIAL PRIMARY KEY,
user_id BIGINT NOT NULL REFERENCES users(id),
platform_role VARCHAR(20) NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
deleted_at TIMESTAMPTZ
);
CREATE UNIQUE INDEX uk_platform_user_role_active ON platform_user_roles(user_id, platform_role) WHERE deleted_at IS NULL;