2022-08-05 04:10:34 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS member_classes (
|
|
|
|
id UUID DEFAULT uuid_generate_v4(),
|
|
|
|
name TEXT NOT NULL,
|
2022-08-07 10:43:16 +00:00
|
|
|
show BOOLEAN NOT NULL DEFAULT TRUE,
|
2022-08-05 04:10:34 +00:00
|
|
|
parent_id UUID,
|
|
|
|
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
|
|
|
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
|
|
|
PRIMARY KEY (id),
|
|
|
|
UNIQUE (name)
|
|
|
|
);
|
|
|
|
|
|
|
|
-- trigger (updated_at)
|
|
|
|
CREATE TRIGGER tg_member_classes_updated_at
|
|
|
|
BEFORE UPDATE
|
|
|
|
ON member_classes
|
|
|
|
FOR EACH ROW
|
|
|
|
EXECUTE PROCEDURE update_updated_at_column();
|