beteran-server-service/migrations/202206301310_member_session/up.sql

15 lines
608 B
MySQL
Raw Normal View History

2022-08-05 04:10:34 +00:00
CREATE TABLE IF NOT EXISTS member_sessions (
id UUID DEFAULT uuid_generate_v4(),
member_id UUID NOT NULL,
ip TEXT,
last_accessed_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
expires_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
PRIMARY KEY (id),
CONSTRAINT fk_member_sessions_member_id
FOREIGN KEY(member_id)
REFERENCES members(id)
);