From e648b0072a8aedf07142f8edb6fa188f14eb5910 Mon Sep 17 00:00:00 2001 From: Johannes Vogt Date: Fri, 21 Mar 2025 16:40:46 +0100 Subject: [PATCH] database changes --- bookstore/package.json | 23 ++++--- db/src/.hdiconfig | 139 ----------------------------------------- db/undeploy.json | 7 --- mta.yaml | 4 +- orders/package.json | 8 ++- package-lock.json | 71 ++++++++++++++++++++- reviews/package.json | 17 +++-- shared-db/db/index.cds | 3 + shared-db/package.json | 17 +++++ 9 files changed, 128 insertions(+), 161 deletions(-) delete mode 100644 db/src/.hdiconfig delete mode 100644 db/undeploy.json create mode 100644 shared-db/db/index.cds create mode 100644 shared-db/package.json diff --git a/bookstore/package.json b/bookstore/package.json index 788baf5f..8102ed67 100644 --- a/bookstore/package.json +++ b/bookstore/package.json @@ -2,11 +2,12 @@ "name": "@capire/bookstore", "version": "1.0.0", "dependencies": { + "@cap-js/hana": "^1.7.0", "@capire/bookshop": "*", - "@capire/reviews": "*", - "@capire/orders": "*", "@capire/common": "*", "@capire/data-viewer": "*", + "@capire/orders": "*", + "@capire/reviews": "*", "@sap/cds": ">=5", "express": "^4.17.1" }, @@ -24,14 +25,22 @@ "model": "@capire/orders" }, "messaging": { - "[development]": { "kind": "file-based-messaging" }, - "[hybrid]": { "kind": "enterprise-messaging-shared" }, - "[production]": { "kind": "enterprise-messaging" } + "[development]": { + "kind": "file-based-messaging" + }, + "[hybrid]": { + "kind": "enterprise-messaging-shared" + }, + "[production]": { + "kind": "enterprise-messaging" + } }, "db": { "kind": "sql" } }, - "log": { "service": true } + "log": { + "service": true + } } -} \ No newline at end of file +} diff --git a/db/src/.hdiconfig b/db/src/.hdiconfig deleted file mode 100644 index 03673f20..00000000 --- a/db/src/.hdiconfig +++ /dev/null @@ -1,139 +0,0 @@ -{ - "file_suffixes": { - "csv": { - "plugin_name": "com.sap.hana.di.tabledata.source" - }, - "hdbafllangprocedure": { - "plugin_name": "com.sap.hana.di.afllangprocedure" - }, - "hdbanalyticprivilege": { - "plugin_name": "com.sap.hana.di.analyticprivilege" - }, - "hdbcalculationview": { - "plugin_name": "com.sap.hana.di.calculationview" - }, - "hdbcollection": { - "plugin_name": "com.sap.hana.di.collection" - }, - "hdbconstraint": { - "plugin_name": "com.sap.hana.di.constraint" - }, - "hdbdropcreatetable": { - "plugin_name": "com.sap.hana.di.dropcreatetable" - }, - "hdbflowgraph": { - "plugin_name": "com.sap.hana.di.flowgraph" - }, - "hdbfunction": { - "plugin_name": "com.sap.hana.di.function" - }, - "hdbgraphworkspace": { - "plugin_name": "com.sap.hana.di.graphworkspace" - }, - "hdbhadoopmrjob": { - "plugin_name": "com.sap.hana.di.virtualfunctionpackage.hadoop" - }, - "hdbindex": { - "plugin_name": "com.sap.hana.di.index" - }, - "hdblibrary": { - "plugin_name": "com.sap.hana.di.library" - }, - "hdbmigrationtable": { - "plugin_name": "com.sap.hana.di.table.migration" - }, - "hdbprocedure": { - "plugin_name": "com.sap.hana.di.procedure" - }, - "hdbprojectionview": { - "plugin_name": "com.sap.hana.di.projectionview" - }, - "hdbprojectionviewconfig": { - "plugin_name": "com.sap.hana.di.projectionview.config" - }, - "hdbreptask": { - "plugin_name": "com.sap.hana.di.reptask" - }, - "hdbresultcache": { - "plugin_name": "com.sap.hana.di.resultcache" - }, - "hdbrole": { - "plugin_name": "com.sap.hana.di.role" - }, - "hdbroleconfig": { - "plugin_name": "com.sap.hana.di.role.config" - }, - "hdbsearchruleset": { - "plugin_name": "com.sap.hana.di.searchruleset" - }, - "hdbsequence": { - "plugin_name": "com.sap.hana.di.sequence" - }, - "hdbstatistics": { - "plugin_name": "com.sap.hana.di.statistics" - }, - "hdbstructuredprivilege": { - "plugin_name": "com.sap.hana.di.structuredprivilege" - }, - "hdbsynonym": { - "plugin_name": "com.sap.hana.di.synonym" - }, - "hdbsynonymconfig": { - "plugin_name": "com.sap.hana.di.synonym.config" - }, - "hdbsystemversioning": { - "plugin_name": "com.sap.hana.di.systemversioning" - }, - "hdbtable": { - "plugin_name": "com.sap.hana.di.table" - }, - "hdbtabledata": { - "plugin_name": "com.sap.hana.di.tabledata" - }, - "hdbtabletype": { - "plugin_name": "com.sap.hana.di.tabletype" - }, - "hdbtrigger": { - "plugin_name": "com.sap.hana.di.trigger" - }, - "hdbview": { - "plugin_name": "com.sap.hana.di.view" - }, - "hdbvirtualfunction": { - "plugin_name": "com.sap.hana.di.virtualfunction" - }, - "hdbvirtualfunctionconfig": { - "plugin_name": "com.sap.hana.di.virtualfunction.config" - }, - "hdbvirtualpackagehadoop": { - "plugin_name": "com.sap.hana.di.virtualpackage.hadoop" - }, - "hdbvirtualpackagesparksql": { - "plugin_name": "com.sap.hana.di.virtualpackage.sparksql" - }, - "hdbvirtualprocedure": { - "plugin_name": "com.sap.hana.di.virtualprocedure" - }, - "hdbvirtualprocedureconfig": { - "plugin_name": "com.sap.hana.di.virtualprocedure.config" - }, - "hdbvirtualtable": { - "plugin_name": "com.sap.hana.di.virtualtable" - }, - "hdbvirtualtableconfig": { - "plugin_name": "com.sap.hana.di.virtualtable.config" - }, - "properties": { - "plugin_name": "com.sap.hana.di.tabledata.properties" - }, - "tags": { - "plugin_name": "com.sap.hana.di.tabledata.properties" - }, - "txt": { - "plugin_name": "com.sap.hana.di.copyonly" - }, - "hdbeshconfig": { - "plugin_name": "com.sap.hana.di.eshconfig" - } - } -} diff --git a/db/undeploy.json b/db/undeploy.json deleted file mode 100644 index aa14b9f1..00000000 --- a/db/undeploy.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "src/gen/**/*.hdbview", - "src/gen/**/*.hdbindex", - "src/gen/**/*.hdbconstraint", - "src/gen/**/*_drafts.hdbtable", - "src/gen/**/*.hdbcalculationview" -] diff --git a/mta.yaml b/mta.yaml index 8ded791f..28f2ad5d 100644 --- a/mta.yaml +++ b/mta.yaml @@ -9,6 +9,8 @@ build-parameters: - builder: custom commands: - npm ci + - npx cds build ./shared-db --for hana --production + - npx cds build --production modules: - name: samples-srv @@ -28,7 +30,7 @@ modules: - name: samples-db-deployer type: hdb - path: gen/db + path: shared-db/gen/db parameters: buildpack: nodejs_buildpack requires: diff --git a/orders/package.json b/orders/package.json index 0267b1a3..40a57ac5 100644 --- a/orders/package.json +++ b/orders/package.json @@ -2,10 +2,16 @@ "name": "@capire/orders", "version": "1.0.0", "dependencies": { + "@cap-js/hana": "^1.7.0", "@capire/common": "*", "@sap/cds": ">=5" }, "scripts": { "start": "cds-serve" + }, + "cds": { + "requires": { + "db": true + } } -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json index 72d33306..da00bf32 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,12 +19,14 @@ "./etc/loggers" ], "dependencies": { + "@cap-js/hana": "^1", "@sap/cds": ">=8" }, "devDependencies": { "@cap-js/cds-test": "^0", "@cap-js/cds-types": "^0", "@cap-js/sqlite": "^1", + "@sap/cds-dk": "^8", "eslint": "^9", "semver": "^7" } @@ -44,6 +46,7 @@ "name": "@capire/bookstore", "version": "1.0.0", "dependencies": { + "@cap-js/hana": "^1.7.0", "@capire/bookshop": "*", "@capire/common": "*", "@capire/data-viewer": "*", @@ -144,7 +147,6 @@ "version": "1.18.0", "resolved": "https://registry.npmjs.org/@cap-js/db-service/-/db-service-1.18.0.tgz", "integrity": "sha512-Gv0X+GZx85Op8GZ+xbkt49Nrrha68jPfV5+Uo023Xqsbv7HhoFPkI1t1IVI+isZRz04dx4MW573b0KKGEFDAFg==", - "dev": true, "license": "SEE LICENSE", "dependencies": { "generic-pool": "^3.9.0" @@ -153,6 +155,25 @@ "@sap/cds": ">=7.9" } }, + "node_modules/@cap-js/hana": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@cap-js/hana/-/hana-1.7.0.tgz", + "integrity": "sha512-QaFQAKT6beFIC61I+3BSq4aSmVydzTziEUy/eb+hWZqfUaqZjujgnI9OPrnLaDeE4dZkOGYj/GAGy39t5vaagA==", + "license": "SEE LICENSE", + "dependencies": { + "@cap-js/db-service": "^1.18.0", + "hdb": "^0.19.5" + }, + "peerDependencies": { + "@sap/cds": ">=8.2", + "@sap/hana-client": ">=2" + }, + "peerDependenciesMeta": { + "@sap/hana-client": { + "optional": true + } + } + }, "node_modules/@cap-js/sqlite": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/@cap-js/sqlite/-/sqlite-1.9.0.tgz", @@ -452,6 +473,40 @@ "node": ">=18" } }, + "node_modules/@sap/cds-dk": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/@sap/cds-dk/-/cds-dk-8.8.2.tgz", + "integrity": "sha512-eF5wO0SnycDVyr4/xIRFiH7W1VANeB+yQoib9veM4oc7M/jkhB34bDZLdWqK7hpKLZ7k66aLc1SOWjOPLQne7g==", + "dev": true, + "hasShrinkwrap": true, + "license": "SEE LICENSE IN LICENSE", + "dependencies": { + "@cap-js/asyncapi": "^1.0.0", + "@cap-js/openapi": "^1.0.0", + "@sap/cds": ">=7", + "@sap/cds-foss": "^5.0.0", + "@sap/cds-mtxs": ">=1.9.0", + "@sap/eslint-plugin-cds": "^3.0.1", + "@sap/hdi-deploy": "^5", + "axios": "^1", + "eslint": "^9", + "express": "^4.17.3", + "hdb": "^0", + "livereload-js": "^4.0.1", + "mustache": "^4.0.1", + "node-watch": ">=0.7", + "ws": "^8.4.2", + "xml-js": "^1.6.11" + }, + "bin": { + "cds": "bin/cds.js", + "cds-ts": "bin/cds-ts.js", + "cds-tsx": "bin/cds-tsx.js" + }, + "optionalDependencies": { + "@cap-js/sqlite": "^1" + } + }, "node_modules/@sap/cds-fiori": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@sap/cds-fiori/-/cds-fiori-1.4.0.tgz", @@ -1966,6 +2021,18 @@ "node": ">= 0.4" } }, + "node_modules/hdb": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/hdb/-/hdb-0.19.12.tgz", + "integrity": "sha512-vv+cjmvr6fNH/s0Q2zOZc4sEjMpSC0KuacFn8dp3L38qM3RA2LLeX70wWhZLESpwvwUf1pQkRfUhZeooFSmv3A==", + "license": "Apache-2.0", + "dependencies": { + "iconv-lite": "^0.4.18" + }, + "engines": { + "node": ">= 0.12" + } + }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -3289,6 +3356,7 @@ "name": "@capire/orders", "version": "1.0.0", "dependencies": { + "@cap-js/hana": "^1.7.0", "@capire/common": "*", "@sap/cds": ">=5" } @@ -3297,6 +3365,7 @@ "name": "@capire/reviews", "version": "1.0.0", "dependencies": { + "@cap-js/hana": "^1.7.0", "@sap/cds": ">=5", "express": "^4.17.1" } diff --git a/reviews/package.json b/reviews/package.json index e1ef80df..4ae33c8c 100644 --- a/reviews/package.json +++ b/reviews/package.json @@ -7,6 +7,7 @@ "index.cds" ], "dependencies": { + "@cap-js/hana": "^1.7.0", "@sap/cds": ">=5", "express": "^4.17.1" }, @@ -16,11 +17,17 @@ "cds": { "requires": { "messaging": { - "[development]": { "kind": "file-based-messaging" }, - "[hybrid]": { "kind": "enterprise-messaging-shared" }, - "[production]": { "kind": "enterprise-messaging" } + "[development]": { + "kind": "file-based-messaging" + }, + "[hybrid]": { + "kind": "enterprise-messaging-shared" + }, + "[production]": { + "kind": "enterprise-messaging" + } }, - "db": { "kind": "sql" } + "db": true } } -} \ No newline at end of file +} diff --git a/shared-db/db/index.cds b/shared-db/db/index.cds new file mode 100644 index 00000000..974d40af --- /dev/null +++ b/shared-db/db/index.cds @@ -0,0 +1,3 @@ +using from '@capire/bookstore'; +using from '@capire/reviews'; +using from '@capire/orders'; diff --git a/shared-db/package.json b/shared-db/package.json new file mode 100644 index 00000000..7d2e72fd --- /dev/null +++ b/shared-db/package.json @@ -0,0 +1,17 @@ +{ + "name": "shared-db", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "description": "", + "cds": { + "sql": { + "native_hana_associations": false + } + } +}