refactor: change feed channel notifyFrequency type to enum
This commit is contained in:
parent
b355a677d3
commit
2ce5597dfe
@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- The `notifyFrequency` column on the `FeedChannel` table would be dropped and recreated. This will lead to data loss if there is data in the column.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- CreateEnum
|
||||||
|
CREATE TYPE "FeedChannelNotifyFrequency" AS ENUM ('event', 'day', 'week', 'month');
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "FeedChannel" DROP COLUMN "notifyFrequency",
|
||||||
|
ADD COLUMN "notifyFrequency" "FeedChannelNotifyFrequency" NOT NULL DEFAULT 'day';
|
@ -446,11 +446,18 @@ model SurveyResult {
|
|||||||
@@index([sessionId])
|
@@index([sessionId])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum FeedChannelNotifyFrequency {
|
||||||
|
event
|
||||||
|
day
|
||||||
|
week
|
||||||
|
month
|
||||||
|
}
|
||||||
|
|
||||||
model FeedChannel {
|
model FeedChannel {
|
||||||
id String @id @default(cuid()) @db.VarChar(30)
|
id String @id @default(cuid()) @db.VarChar(30)
|
||||||
workspaceId String @db.VarChar(30)
|
workspaceId String @db.VarChar(30)
|
||||||
name String
|
name String
|
||||||
notifyFrequency String @default("day")
|
notifyFrequency FeedChannelNotifyFrequency @default(day)
|
||||||
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
||||||
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
||||||
|
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import * as z from "zod"
|
import * as z from "zod"
|
||||||
import * as imports from "./schemas"
|
import * as imports from "./schemas"
|
||||||
|
import { FeedChannelNotifyFrequency } from "@prisma/client"
|
||||||
import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteFeedEvent, RelatedFeedEventModelSchema, CompleteNotification, RelatedNotificationModelSchema } from "./index"
|
import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteFeedEvent, RelatedFeedEventModelSchema, CompleteNotification, RelatedNotificationModelSchema } from "./index"
|
||||||
|
|
||||||
export const FeedChannelModelSchema = z.object({
|
export const FeedChannelModelSchema = z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
workspaceId: z.string(),
|
workspaceId: z.string(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
notifyFrequency: z.string(),
|
notifyFrequency: z.nativeEnum(FeedChannelNotifyFrequency),
|
||||||
createdAt: z.date(),
|
createdAt: z.date(),
|
||||||
updatedAt: z.date(),
|
updatedAt: z.date(),
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user