Skip to content

Commit 425ebe3

Browse files
committed
feat(db): add versioning and lastUpdatedBy to env vars
Add a version integer (default 1) and a lastUpdatedBy JSON field to the EnvironmentVariableValue model. Include a migration that alters the EnvironmentVariableValue table to add the version column (NOT NULL, default 1) and the lastUpdatedBy JSONB column. This enables simple optimistic versioning and stores metadata about the actor that last updated an environment variable, improving concurrency control and auditability.
1 parent ca5a494 commit 425ebe3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- AlterTable
2+
ALTER TABLE "public"."EnvironmentVariableValue" ADD COLUMN "lastUpdatedBy" JSONB,
3+
ADD COLUMN "version" INTEGER NOT NULL DEFAULT 1;

internal-packages/database/prisma/schema.prisma

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,9 @@ model EnvironmentVariableValue {
17131713
createdAt DateTime @default(now())
17141714
updatedAt DateTime @updatedAt
17151715
1716+
version Int @default(1)
1717+
lastUpdatedBy Json?
1718+
17161719
@@unique([variableId, environmentId])
17171720
}
17181721

0 commit comments

Comments
 (0)