add logging and also add dates to the channel table
This commit is contained in:
parent
c98a59601e
commit
d53d7a2b6a
|
@ -20,6 +20,7 @@ const command = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("Joining channel: " + msg.senderUsername);
|
||||||
const storeChannel = await prisma.channel.create({
|
const storeChannel = await prisma.channel.create({
|
||||||
data: {
|
data: {
|
||||||
name: msg.senderUsername,
|
name: msg.senderUsername,
|
||||||
|
|
|
@ -14,6 +14,7 @@ const command = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("Parting channel: " + msg.senderUsername);
|
||||||
const partChannel = await prisma.channel.delete({
|
const partChannel = await prisma.channel.delete({
|
||||||
where: {
|
where: {
|
||||||
name: msg.senderUsername,
|
name: msg.senderUsername,
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- Added the required column `updatedAt` to the `Channel` table without a default value. This is not possible if the table is not empty.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- RedefineTables
|
||||||
|
PRAGMA foreign_keys=OFF;
|
||||||
|
CREATE TABLE "new_Channel" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"name" TEXT NOT NULL,
|
||||||
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" DATETIME NOT NULL
|
||||||
|
);
|
||||||
|
INSERT INTO "new_Channel" ("id", "name") SELECT "id", "name" FROM "Channel";
|
||||||
|
DROP TABLE "Channel";
|
||||||
|
ALTER TABLE "new_Channel" RENAME TO "Channel";
|
||||||
|
CREATE UNIQUE INDEX "Channel_name_key" ON "Channel"("name");
|
||||||
|
PRAGMA foreign_key_check;
|
||||||
|
PRAGMA foreign_keys=ON;
|
|
@ -13,6 +13,9 @@ datasource db {
|
||||||
model Channel {
|
model Channel {
|
||||||
id String @id @default(uuid())
|
id String @id @default(uuid())
|
||||||
name String @unique
|
name String @unique
|
||||||
|
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
}
|
}
|
||||||
|
|
||||||
model User {
|
model User {
|
||||||
|
|
Loading…
Reference in New Issue