astral-api/Astral.DAL/Migrations/2024-12-11.01-userGroups.sql

17 lines
658 B
MySQL
Raw Normal View History

2024-12-11 21:36:30 +01:00
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();