Update schema to remove default values and add new table

Removed default values for 'isRestricted' and 'isDocumentation' columns in the FilesTable. Added a new intermediary table 'FilesForMachinesTable' to establish a many-to-many relationship between 'File' and 'Machine'.
This commit is contained in:
Mathis H (Avnyr) 2024-10-07 12:01:29 +02:00
parent 65118e9465
commit ceef9f94b6
Signed by: Mathis
GPG Key ID: DD9E0666A747D126

View File

@ -83,9 +83,9 @@ export const FilesTable = pgTable("files", {
.notNull() .notNull()
.references(() => FilesTypesTable.id), .references(() => FilesTypesTable.id),
isRestricted: p.boolean("is_restricted").default(false).notNull(), isRestricted: p.boolean("is_restricted").notNull(),
isDocumentation: p.boolean("is_documentation").default(false).notNull(), isDocumentation: p.boolean("is_documentation").notNull(),
uploadedAt: p uploadedAt: p
.timestamp("uploaded_at", { .timestamp("uploaded_at", {
@ -151,6 +151,19 @@ export const MachinesTable = pgTable("machines", {
//supported files format //supported files format
}); });
//TODO Many to Many table betwen File en Machine
export const FilesForMachinesTable = pgTable("files_for_machines", {
fileId: p
.uuid("file_id")
.notNull()
.references(() => FilesTable.uuid),
machineId: p
.uuid("machine_id")
.notNull()
.references(() => MachinesTable.id),
});
export const FilesTypeForMachine = pgTable("f_type_for_machines", { export const FilesTypeForMachine = pgTable("f_type_for_machines", {
machineId: p machineId: p
.uuid("machine_id") .uuid("machine_id")