Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

Add created at / updated at timestamps (#40)

Marc Klingen32a23d2023e8
diff --git a/prisma/migrations/20230705160335_add_created_updated_timestamps/migration.sql b/prisma/migrations/20230705160335_add_created_updated_timestamps/migration.sql
new file mode 100644
index 0000000000..d4b8e7aa13
--- /dev/null
+++ b/prisma/migrations/20230705160335_add_created_updated_timestamps/migration.sql
@@ -0,0 +1,7 @@
+-- AlterTable
+ALTER TABLE "memberships" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
+
+-- AlterTable
+ALTER TABLE "users" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index f91812264f..49cc435463 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -55,6 +55,8 @@ model User {
accounts Account[]
sessions Session[]
memberships Membership[]
+ createdAt DateTime @default(now()) @map("created_at")
+ updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
@@map("users")
}
@@ -100,6 +102,8 @@ model Membership {
userId String @map("user_id")
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
role MembershipRole
+ createdAt DateTime @default(now()) @map("created_at")
+ updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
@@id([projectId, userId])
@@map("memberships")