mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-18 13:44:13 +02:00
refactor(db): fix warning table to follow prisma naming convention
This commit is contained in:
parent
d0d9dbacfd
commit
eb345d1866
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `Warnings` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Warnings" DROP CONSTRAINT "Warnings_modId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Warnings" DROP CONSTRAINT "Warnings_userId_fkey";
|
||||
|
||||
-- RenameTable
|
||||
ALTER TABLE "Warnings" RENAME TO "Warning";
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Warning" ADD CONSTRAINT "Warning_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Warning" ADD CONSTRAINT "Warning_modId_fkey" FOREIGN KEY ("modId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Warning" RENAME CONSTRAINT "Warnings_pkey" TO "Warning_pkey";
|
@ -39,8 +39,8 @@ model User {
|
||||
VerifyVerifier Verify[] @relation("verVerifier")
|
||||
SusUser Sus[] @relation("susUser")
|
||||
SusMod Sus[] @relation("susMod")
|
||||
WarnUser Warnings[] @relation("warnUser")
|
||||
WarnMod Warnings[] @relation("warnMod")
|
||||
WarnUser Warning[] @relation("warnUser")
|
||||
WarnMod Warning[] @relation("warnMod")
|
||||
RestrictUser Restrict[] @relation("restUser")
|
||||
RestrictMod Restrict[] @relation("restMod")
|
||||
RestrictEndMod Restrict[] @relation("endRestMod")
|
||||
@ -93,7 +93,7 @@ model Sus {
|
||||
note String
|
||||
}
|
||||
|
||||
model Warnings {
|
||||
model Warning {
|
||||
id Int @id @default(autoincrement())
|
||||
user User @relation("warnUser", fields: [userId], references: [id])
|
||||
userId String
|
||||
|
@ -2,7 +2,7 @@ import { container } from '@sapphire/framework';
|
||||
import type { Snowflake } from 'discord.js';
|
||||
|
||||
export async function addWarn(userId: Snowflake, modId: Snowflake, message: string) {
|
||||
await container.database.warnings.create({
|
||||
await container.database.warning.create({
|
||||
data: {
|
||||
user: {
|
||||
connect: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user