18 lines
573 B
SQL
18 lines
573 B
SQL
CREATE TABLE IF NOT EXISTS member_levels (
|
|
id UUID DEFAULT uuid_generate_v4(),
|
|
name TEXT NOT NULL,
|
|
show BOOLEAN NOT NULL DEFAULT TRUE,
|
|
sort_order INTEGER NOT NULL,
|
|
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_levels_updated_at
|
|
BEFORE UPDATE
|
|
ON member_levels
|
|
FOR EACH ROW
|
|
EXECUTE PROCEDURE update_updated_at_column();
|