astral-api/Astral.DAL/Migrations/2024-12-11.01-userGroups.sql
2024-12-11 20:36:30 +00:00

16 lines
658 B
SQL

CREATE TABLE userGroups
(
id UUID UNIQUE PRIMARY KEY NOT NULL,
createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
internal BOOLEAN DEFAULT FALSE NOT NULL,
ownerUserId UUID REFERENCES users (id) ON DELETE CASCADE NOT NULL,
title TEXT NOT NULL,
description TEXT DEFAULT '' NOT NULL
);
CREATE TRIGGER userGroups_updated_at
BEFORE UPDATE
ON userGroups
FOR EACH ROW
EXECUTE PROCEDURE updated_at_timestamp();