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.
This commit is contained in:
Mathis H (Avnyr) 2024-10-08 11:30:37 +02:00
parent b182d740bd
commit 711877bf60
Signed by: Mathis
GPG Key ID: DD9E0666A747D126

View File

@ -153,6 +153,8 @@ export const MachinesTable = pgTable("machines", {
//TODO Many to Many table betwen File en Machine //TODO Many to Many table betwen File en Machine
export const FilesForMachinesTable = pgTable("files_for_machines", { export const FilesForMachinesTable = pgTable("files_for_machines", {
id: p.uuid('id').primaryKey().notNull().defaultRandom(),
fileId: p fileId: p
.uuid("file_id") .uuid("file_id")
.notNull() .notNull()