From a451b6eb3c387a90822633cd9a798860e561ff3a Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 6 Aug 2024 09:58:02 +0100 Subject: [PATCH] Add Oracle to datasource.spec.ts. --- .../server/src/api/routes/tests/datasource.spec.ts | 10 ++-------- packages/server/src/integrations/oracle.ts | 4 +++- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/server/src/api/routes/tests/datasource.spec.ts b/packages/server/src/api/routes/tests/datasource.spec.ts index 4ca766247b..127ebaa6ae 100644 --- a/packages/server/src/api/routes/tests/datasource.spec.ts +++ b/packages/server/src/api/routes/tests/datasource.spec.ts @@ -164,6 +164,7 @@ describe("/datasources", () => { [DatabaseName.MYSQL, getDatasource(DatabaseName.MYSQL)], [DatabaseName.SQL_SERVER, getDatasource(DatabaseName.SQL_SERVER)], [DatabaseName.MARIADB, getDatasource(DatabaseName.MARIADB)], + [DatabaseName.ORACLE, getDatasource(DatabaseName.ORACLE)], ])("%s", (_, dsProvider) => { let rawDatasource: Datasource beforeEach(async () => { @@ -285,9 +286,6 @@ describe("/datasources", () => { [FieldType.STRING]: { name: stringName, type: FieldType.STRING, - constraints: { - presence: true, - }, }, [FieldType.LONGFORM]: { name: "longform", @@ -381,10 +379,6 @@ describe("/datasources", () => { ), schema: Object.entries(table.schema).reduce( (acc, [fieldName, field]) => { - // the constraint will be unset - as the DB doesn't recognise it as not null - if (fieldName === stringName) { - field.constraints = {} - } acc[fieldName] = expect.objectContaining({ ...field, }) @@ -441,7 +435,7 @@ describe("/datasources", () => { }) describe("info", () => { - it("should fetch information about postgres datasource", async () => { + it("should fetch information about a datasource", async () => { const table = await config.api.table.save( tableForDatasource(datasource, { schema: { diff --git a/packages/server/src/integrations/oracle.ts b/packages/server/src/integrations/oracle.ts index d1c0978b89..545cbf40f6 100644 --- a/packages/server/src/integrations/oracle.ts +++ b/packages/server/src/integrations/oracle.ts @@ -400,7 +400,9 @@ class OracleIntegration extends Sql implements DatasourcePlus { if (oracleConstraint.type === OracleContraintTypes.PRIMARY) { table.primary!.push(columnName) } else if ( - oracleConstraint.type === OracleContraintTypes.NOT_NULL_OR_CHECK + oracleConstraint.type === + OracleContraintTypes.NOT_NULL_OR_CHECK && + oracleConstraint.searchCondition?.endsWith("IS NOT NULL") ) { table.schema[columnName].constraints = { presence: true,