feat: update template
This commit is contained in:
25
internal/db/migrations/000012_add_access_logs.up.sql
Normal file
25
internal/db/migrations/000012_add_access_logs.up.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
CREATE TABLE access_logs
|
||||
(
|
||||
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
||||
request_id TEXT,
|
||||
user_id INTEGER,
|
||||
ip INET,
|
||||
user_agent TEXT,
|
||||
request_method VARCHAR(10) NOT NULL,
|
||||
request_path TEXT NOT NULL,
|
||||
referer TEXT,
|
||||
message TEXT,
|
||||
status_code INTEGER,
|
||||
response_time_ms INTEGER,
|
||||
started_at TIMESTAMPTZ NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX idx_access_logs_created_at
|
||||
ON access_logs (created_at);
|
||||
|
||||
CREATE INDEX idx_access_logs_request_path
|
||||
ON access_logs (request_path);
|
||||
|
||||
CREATE INDEX idx_access_logs_ip
|
||||
ON access_logs (ip);
|
||||
Reference in New Issue
Block a user