🗃️ Add updatedAt fields where missing
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `lastUsedAt` on the `ApiToken` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "ApiToken" DROP COLUMN "lastUsedAt";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "CollaboratorsOnTypebots" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Invitation" ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "MemberInWorkspace" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Workspace" ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "WorkspaceInvitation" ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
@@ -57,20 +57,20 @@ model User {
|
||||
}
|
||||
|
||||
model ApiToken {
|
||||
id String @id @default(cuid())
|
||||
token String @unique
|
||||
name String
|
||||
ownerId String
|
||||
lastUsedAt DateTime @default(now())
|
||||
createdAt DateTime @default(now())
|
||||
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
token String @unique
|
||||
name String
|
||||
ownerId String
|
||||
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model Workspace {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
name String
|
||||
icon String?
|
||||
createdAt DateTime @default(now())
|
||||
plan Plan @default(FREE)
|
||||
stripeId String? @unique
|
||||
credentials Credentials[]
|
||||
@@ -92,6 +92,8 @@ model Workspace {
|
||||
}
|
||||
|
||||
model MemberInWorkspace {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
userId String
|
||||
workspaceId String
|
||||
role WorkspaceRole
|
||||
@@ -104,6 +106,7 @@ model MemberInWorkspace {
|
||||
model WorkspaceInvitation {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
email String
|
||||
workspaceId String
|
||||
type WorkspaceRole
|
||||
@@ -180,6 +183,7 @@ model Typebot {
|
||||
|
||||
model Invitation {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
email String
|
||||
typebotId String
|
||||
type CollaborationType
|
||||
@@ -189,6 +193,8 @@ model Invitation {
|
||||
}
|
||||
|
||||
model CollaboratorsOnTypebots {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
userId String
|
||||
typebotId String
|
||||
type CollaborationType
|
||||
@@ -240,7 +246,7 @@ model Log {
|
||||
}
|
||||
|
||||
model Answer {
|
||||
createdAt DateTime @default(now())
|
||||
createdAt DateTime @default(now()) @updatedAt
|
||||
resultId String
|
||||
blockId String
|
||||
groupId String
|
||||
|
||||
@@ -19,6 +19,7 @@ export const answerInputSchema =
|
||||
answerSchema
|
||||
.omit({
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
resultId: true,
|
||||
variableId: true,
|
||||
storageUsed: true,
|
||||
|
||||
@@ -30,7 +30,7 @@ export type WebhookResponse = {
|
||||
|
||||
export const defaultWebhookAttributes: Omit<
|
||||
Webhook,
|
||||
'id' | 'body' | 'url' | 'typebotId'
|
||||
'id' | 'body' | 'url' | 'typebotId' | 'createdAt' | 'updatedAt'
|
||||
> = {
|
||||
method: HttpMethod.POST,
|
||||
headers: [],
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from 'db'
|
||||
|
||||
export const workspaceMemberSchema = schemaForType<
|
||||
Omit<MemberInWorkspacePrisma, 'userId'> & {
|
||||
Omit<MemberInWorkspacePrisma, 'userId' | 'createdAt' | 'updatedAt'> & {
|
||||
user: Pick<UserPrisma, 'name' | 'email' | 'image'>
|
||||
}
|
||||
>()(
|
||||
@@ -29,17 +29,19 @@ export const workspaceInvitationSchema = schemaForType<
|
||||
Omit<WorkspaceInvitationPrisma, 'workspaceId' | 'userId' | 'id'>
|
||||
>()(
|
||||
z.object({
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
email: z.string(),
|
||||
type: z.nativeEnum(WorkspaceRole),
|
||||
createdAt: z.date(),
|
||||
})
|
||||
)
|
||||
|
||||
export const workspaceSchema = schemaForType<WorkspacePrisma>()(
|
||||
z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
name: z.string(),
|
||||
icon: z.string().nullable(),
|
||||
plan: z.nativeEnum(Plan),
|
||||
stripeId: z.string().nullable(),
|
||||
|
||||
Reference in New Issue
Block a user