schema update
This commit is contained in:
parent
922c6b7df3
commit
9b38c6a5e9
29 changed files with 184 additions and 43 deletions
|
@ -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"],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue