mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-29 22:58:18 -05:00
User reports (#3232)
This commit is contained in:
25
migrations/157-user-report.js
Normal file
25
migrations/157-user-report.js
Normal file
@@ -0,0 +1,25 @@
|
||||
export function up(db) {
|
||||
db.transaction(() => {
|
||||
db.prepare(
|
||||
/* sql */ `
|
||||
create table "UserReport" (
|
||||
"id" integer primary key autoincrement,
|
||||
"reportedUserId" integer not null,
|
||||
"reporterUserId" integer not null,
|
||||
"category" text not null,
|
||||
"description" text not null,
|
||||
"createdAt" integer default (strftime('%s', 'now')) not null,
|
||||
foreign key ("reportedUserId") references "User"("id") on delete cascade,
|
||||
foreign key ("reporterUserId") references "User"("id") on delete cascade,
|
||||
unique ("reportedUserId", "reporterUserId")
|
||||
) strict
|
||||
`,
|
||||
).run();
|
||||
|
||||
db.prepare(
|
||||
/* sql */ `create index user_report_reported_user_id_idx on "UserReport"("reportedUserId")`,
|
||||
).run();
|
||||
|
||||
db.pragma("foreign_key_check");
|
||||
})();
|
||||
}
|
||||
Reference in New Issue
Block a user