added get channels

This commit is contained in:
Ren Amamiya
2023-04-10 16:44:18 +07:00
parent fabc0e6cc2
commit 0bfcb10253
5 changed files with 126 additions and 3 deletions

View File

@@ -0,0 +1,17 @@
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Channel" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"eventId" TEXT NOT NULL,
"content" TEXT NOT NULL,
"active" BOOLEAN NOT NULL DEFAULT false,
"accountId" INTEGER NOT NULL,
CONSTRAINT "Channel_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "Account" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_Channel" ("accountId", "content", "eventId", "id") SELECT "accountId", "content", "eventId", "id" FROM "Channel";
DROP TABLE "Channel";
ALTER TABLE "new_Channel" RENAME TO "Channel";
CREATE UNIQUE INDEX "Channel_eventId_key" ON "Channel"("eventId");
CREATE INDEX "Channel_eventId_idx" ON "Channel"("eventId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;

View File

@@ -80,9 +80,10 @@ model Chat {
}
model Channel {
id Int @id @default(autoincrement())
eventId String @unique
id Int @id @default(autoincrement())
eventId String @unique
content String
active Boolean @default(false)
Account Account @relation(fields: [accountId], references: [id])
accountId Int