feat: improve learning and platform operations
This commit is contained in:
13
server/migrations/005_audit_log.sql
Normal file
13
server/migrations/005_audit_log.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
create table audit_logs (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
actor_id uuid references users(id) on delete set null,
|
||||
action text not null check (char_length(action) between 1 and 120),
|
||||
subject_type text not null check (char_length(subject_type) between 1 and 80),
|
||||
subject_id uuid,
|
||||
metadata jsonb not null default '{}'::jsonb,
|
||||
ip_address inet,
|
||||
created_at timestamptz not null default now()
|
||||
);
|
||||
|
||||
create index audit_logs_created_index on audit_logs (created_at desc);
|
||||
create index audit_logs_actor_index on audit_logs (actor_id, created_at desc);
|
||||
Reference in New Issue
Block a user