From 711877bf60bcaf6890c99eaec93fae5a46553028 Mon Sep 17 00:00:00 2001 From: Mathis Date: Tue, 8 Oct 2024 11:30:37 +0200 Subject: [PATCH] Add primary key to FilesForMachinesTable Introduce a primary key field 'id' with UUID type to the FilesForMachinesTable. This ensures each record is uniquely identifiable and improves database integrity. Additionally, set a default value to a random UUID for new entries. --- apps/backend/src/app/db/schema.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/backend/src/app/db/schema.ts b/apps/backend/src/app/db/schema.ts index a94c22c..55b9956 100644 --- a/apps/backend/src/app/db/schema.ts +++ b/apps/backend/src/app/db/schema.ts @@ -153,6 +153,8 @@ export const MachinesTable = pgTable("machines", { //TODO Many to Many table betwen File en Machine export const FilesForMachinesTable = pgTable("files_for_machines", { + id: p.uuid('id').primaryKey().notNull().defaultRandom(), + fileId: p .uuid("file_id") .notNull()