mirror of
https://github.com/v0l/route96.git
synced 2025-06-21 07:30:46 +00:00
[WIP] Reporting (#19)
* Initial plan for issue * Add database migration and report structures Co-authored-by: v0l <1172179+v0l@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: v0l <1172179+v0l@users.noreply.github.com>
This commit is contained in:
28
migrations/20250610135841_reports.sql
Normal file
28
migrations/20250610135841_reports.sql
Normal file
@ -0,0 +1,28 @@
|
||||
-- Create reports table for file reporting functionality
|
||||
create table reports
|
||||
(
|
||||
id integer unsigned not null auto_increment primary key,
|
||||
file_id binary(32) not null,
|
||||
reporter_id integer unsigned not null,
|
||||
event_json text not null,
|
||||
created timestamp default current_timestamp,
|
||||
|
||||
constraint fk_reports_file
|
||||
foreign key (file_id) references uploads (id)
|
||||
on delete cascade
|
||||
on update restrict,
|
||||
|
||||
constraint fk_reports_reporter
|
||||
foreign key (reporter_id) references users (id)
|
||||
on delete cascade
|
||||
on update restrict
|
||||
);
|
||||
|
||||
-- Unique index to prevent duplicate reports from same user for same file
|
||||
create unique index ix_reports_file_reporter on reports (file_id, reporter_id);
|
||||
|
||||
-- Index for efficient lookups by file
|
||||
create index ix_reports_file_id on reports (file_id);
|
||||
|
||||
-- Index for efficient lookups by reporter
|
||||
create index ix_reports_reporter_id on reports (reporter_id);
|
Reference in New Issue
Block a user