schema update

This commit is contained in:
Julian Krauser 2025-07-25 11:04:53 +02:00
parent 922c6b7df3
commit 9b38c6a5e9
29 changed files with 184 additions and 43 deletions

View file

@ -93,7 +93,9 @@ export const inspection_table = new Table({
{ name: "id", ...getTypeByORM("uuid"), ...isUUIDPrimary },
{ name: "context", ...getTypeByORM("text") },
{ name: "createdAt", ...getTypeByORM("datetime"), default: getDefaultByORM("currentTimestamp") },
{ name: "finishedAt", ...getTypeByORM("date", true) },
{ name: "finishedAt", ...getTypeByORM("datetime", true) },
{ name: "finishedById", ...getTypeByORM("uuid", true) },
{ name: "finishedByString", ...getTypeByORM("varchar", true) },
{ name: "nextInspection", ...getTypeByORM("date", true) },
{ name: "hasNewer", ...getTypeByORM("boolean"), default: getDefaultByORM("boolean", false) },
{ name: "inspectionPlanId", ...getTypeByORM("uuid") },
@ -103,6 +105,13 @@ export const inspection_table = new Table({
{ name: "wearableId", ...getTypeByORM("uuid", true) },
],
foreignKeys: [
new TableForeignKey({
columnNames: ["finishedById"],
referencedColumnNames: ["id"],
referencedTableName: "user",
onDelete: "SET NULL",
onUpdate: "RESTRICT",
}),
new TableForeignKey({
columnNames: ["inspectionPlanId"],
referencedColumnNames: ["id"],