diff --git a/backend/db_migrations/0042-projectinfo-more-optional-fields.sql b/backend/db_migrations/0042-projectinfo-more-optional-fields.sql new file mode 100644 index 00000000..e4940efc --- /dev/null +++ b/backend/db_migrations/0042-projectinfo-more-optional-fields.sql @@ -0,0 +1,3 @@ +ALTER TABLE sap_project +ALTER COLUMN project_manager_name DROP NOT NULL, +ALTER COLUMN applicant_name DROP NOT NULL; diff --git a/backend/src/components/sap/dataImport.ts b/backend/src/components/sap/dataImport.ts index 0d5a1367..52f7c0a8 100644 --- a/backend/src/components/sap/dataImport.ts +++ b/backend/src/components/sap/dataImport.ts @@ -88,8 +88,8 @@ async function insertProject(conn: DatabaseTransactionConnection, project: SAPPr ${project.createdBy}, ${project.updatedAt ?? null}, ${project.updatedBy ?? null}, - ${project.projectManagerName}, - ${project.applicantName}, + ${project.projectManagerName ?? null}, + ${project.applicantName ?? null}, ${project.plannedStartDate ?? null}, ${project.plannedEndDate ?? null}, ${project.plant ?? null} diff --git a/shared/src/schema/sapProject.ts b/shared/src/schema/sapProject.ts index 4243440f..438832d2 100644 --- a/shared/src/schema/sapProject.ts +++ b/shared/src/schema/sapProject.ts @@ -70,8 +70,8 @@ export const incomingSapProjectSchema = z.object({ ERNAM: z.string(), AEDAT: isoDateString.nullish(), AENAM: z.string().nullish(), - VERNA: z.string(), - ASTNA: z.string(), + VERNA: z.string().nullish(), + ASTNA: z.string().nullish(), PLFAZ: isoDateString.nullish(), PLSEZ: isoDateString.nullish(), WERKS: z.string().nullish(), @@ -148,8 +148,8 @@ export const sapProjectSchema = z.object({ createdBy: z.string(), updatedAt: isoDateString.nullish(), updatedBy: z.string().nullish(), - projectManagerName: z.string(), - applicantName: z.string(), + projectManagerName: z.string().nullish(), + applicantName: z.string().nullish(), plannedStartDate: isoDateString.nullish(), plannedEndDate: isoDateString.nullish(), plant: z.string().nullish(),