beteran-server-service/migrations/202206201220_member_level/up.sql

18 lines
551 B
MySQL
Raw Normal View History

2022-08-05 04:10:34 +00:00
CREATE TABLE IF NOT EXISTS member_levels (
id UUID DEFAULT uuid_generate_v4(),
name TEXT NOT NULL,
sort_order SMALLINT NOT NULL,
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
updated_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
deleted_at BIGINT,
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();