{"id":16163342,"url":"https://github.com/gregorwolf/pg-beershop","last_synced_at":"2025-09-05T02:42:08.737Z","repository":{"id":36973093,"uuid":"285676273","full_name":"gregorwolf/pg-beershop","owner":"gregorwolf","description":"CAP Beershop with PostgreSQL","archived":false,"fork":false,"pushed_at":"2024-12-31T10:00:09.000Z","size":2695,"stargazers_count":45,"open_issues_count":11,"forks_count":20,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-09T02:43:34.314Z","etag":null,"topics":["cap","cloud-foundry","postgres","postgresql","sample","sap-btp","sap-cap"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gregorwolf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["gregorwolf"],"patreon":null,"open_collective":null,"ko_fi":"gregorwolf","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-08-06T21:38:00.000Z","updated_at":"2025-04-27T05:43:39.000Z","dependencies_parsed_at":"2023-12-21T22:27:05.372Z","dependency_job_id":"af35f3a5-6efe-43b3-b126-275147b29d70","html_url":"https://github.com/gregorwolf/pg-beershop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gregorwolf/pg-beershop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fpg-beershop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fpg-beershop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fpg-beershop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fpg-beershop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregorwolf","download_url":"https://codeload.github.com/gregorwolf/pg-beershop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fpg-beershop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273703406,"owners_count":25153000,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cap","cloud-foundry","postgres","postgresql","sample","sap-btp","sap-cap"],"created_at":"2024-10-10T02:35:19.534Z","updated_at":"2025-09-05T02:42:08.711Z","avatar_url":"https://github.com/gregorwolf.png","language":"JavaScript","funding_links":["https://github.com/sponsors/gregorwolf","https://ko-fi.com/gregorwolf"],"categories":[],"sub_categories":[],"readme":"# CAP Beershop using PostgreSQL for persistence\n\n[![Build Status](https://dev.azure.com/gregorwolf/gregorwolf/_apis/build/status/gregorwolf.pg-beershop?branchName=main)](https://dev.azure.com/gregorwolf/gregorwolf/_build/latest?definitionId=2\u0026branchName=main)\n\n## Local execution\n\n### Prerequisites\n\nTo get started quickly you need docker and docker-compose.\n\n### Setup\n\nBefore you start please install all required dependencies using:\n\n```\nnpm ci\n```\n\nStart the PostgreSQL database and [Adminer](https://www.adminer.org/) using:\n\n```\nnpm run docker:start:pg\n```\n\nIt will use the latest available PostgreSQL Docker container. If you want to test with PostgreSQL 11 then run:\n\n```\nnpm run docker:start:pg:11\n```\n\nNow deploy the database schema with the command:\n\n```\nnpm run deploy:pg\n```\n\nThe deploy will automatically load any data which is made available via local CSV files. If you run into any issue there make sure that no .env file is present in the root folder of this project like it would be needed if you want to run the docker image.\n\nThen open [http://localhost:8080/](http://localhost:8080/) and login by selecting System _PostgreSQL_, Server: _beershop-postgresql_, Username _postgres_ and Password _postgres_. The database _postgres_ should already exist as you've just deployed it and the tables should contain data.\n\nNow you can start the CAP application by using:\n\n```\ncds watch --profile pg\n```\n\nThen open \u003chttp://localhost:4004/odata/v4/beershop/Beers\u003e in the browser and you should see an ODATA response with 11 beers:\n\n```JSON\n{\n  \"@odata.context\": \"$metadata#Beers\",\n  \"value\": [\n    {\n      \"ID\": \"b8c3fc14-22e2-4f42-837a-e6134775a186\",\n      \"name\": \"Lagerbier Hell\",\n      \"abv\": 5.2,\n      \"ibu\": 12,\n      \"brewery_ID\": \"9c937100-d459-491f-a72d-81b2929af10f\"\n    },\n    {\n      \"ID\": \"9e1704e3-6fd0-4a5d-bfb1-13ac47f7976b\",\n      \"name\": \"Schönramer Hell\",\n      \"abv\": 5,\n      \"ibu\": 20,\n      \"brewery_ID\": \"fa6b959e-3a01-40ef-872e-6030ee4de4e5\"\n    },\n    ...\n  ]\n}\n```\n\nTo stop the docker containers run either\n\n```\nnpm run docker:stop:pg\n```\n\nor `npm run docker:stop:pg:11`.\n\n## Run on SAP Business Technology Platform - Cloud Foundry Environment with Hyperscaler Option\n\nWe're using the mbt build to create a mtar that can be deployed to the SAP CP Cloud Foundry. The build ist started with:\n\n```\nnpm run build:cf\n```\n\nlogin to Cloud Foundry with:\n\n```\ncf login --sso\n```\n\nthen you can deploy with:\n\n```\nnpm run deploy:cf\n```\n\n## Run on SAP Business Technology Platform - Cloud Foundry Environment with Service Broker\n\nUntil [SAP will provide a fully managed PostgreSQL DB](https://blogs.sap.com/2020/02/11/consuming-hyper-scaler-backing-services-on-sap-cloud-platform-an-update/) you need to provide your on PostgreSQL DB. One way is to install a [Open Service Broker](https://www.openservicebrokerapi.org/). The page [Compliant Service Brokers](https://www.openservicebrokerapi.org/compliant-service-brokers) lists brokers supporting AWS, Azure and GCP. The SAP Developers Tutorial Mission [Use Microsoft Azure Services in SAP Cloud Platform](https://developers.sap.com/mission.cp-azure-services.html) describes in great detail how to setup the Service Broker for Azure. When you finished this setup you can run:\n\n```\nnpm run create-service:pg:dbms\n```\n\nto instantiate a PostgreSQL DBMS. Then run:\n\n```\nnpm run create-service:pg:db\n```\n\nto create a the beershop database in the DBMS. With that operation done you can build the MTA by running:\n\n```\nnpm run build:cf\n```\n\nThat MTA can be deployed using:\n\n```\nnpm run deploy:cf\n```\n\nThe created database is empty. As currently no deploy script is available the needed tables and views for the CAP application need to be created before you can run the application. The easiest way to create the tables and views is to use Adminer as for the local deployment. You can get the credentials by opening the pg-beershop-srv application via the SAP Business Technology Platform Cockpit. Navigate to the Service Bindings and click on \"Show sensitive data\". Enter the data in the corresponding fields of the Adminer login screen. Execute the SQL commands you find in _beershop.sql_. To fill the database with data also execute the ones in _beershop-data.sql_. Now try out the URL you find in the Overview of the pg-beershop-srv application.\n\n## Run on SAP Business Technology Platform - External PostgreSQL\n\nTo test with an external PostgreSQL created an Azure Database for PostgreSQL flexible server. Via the Azure portal add the database beershop. Then checkout the branch `user-provided-service` and create `default-azure-ups-env.json` with the following content:\n\n```JSON\n{\n  \"username\": \"\u003cyour user\u003e\",\n  \"password\": \"\u003cyour password\u003e\",\n  \"hostname\": \"\u003cyour hostname\u003e\",\n  \"dbname\": \"beershop\",\n  \"port\": \"5432\",\n  \"ssl\": true\n}\n\n```\n\nNow you can build and deploy as described above.\n\n## Run on SAP Business Technology Platform - Kyma Environment\n\n### Create Docker Image\n\nIf you want to build your own docker image replace _gregorwolf_ in _package.json_ and _deployment/beershop.yaml_ with your own hub.docker.com account. Then run:\n\n```\nnpm run build:docker\n```\n\nTo test the image locally you have to create a _.env_ file that provides the environment variable VCAP_SERVICES which contains the connection information. Fill it with the following content:\n\n`VCAP_SERVICES={\"docker-postgres\":[{\"name\":\"postgres\",\"label\":\"postgres\",\"tags\":[\"plain\", \"db\", \"relational\", \"database\"],\"credentials\":{\"host\":\"beershop-postgresql\",\"port\":\"5432\",\"database\":\"beershop\",\"user\":\"postgres\",\"password\":\"postgres\"}}]}`\n\nThen run:\n\n```\nnpm run docker:run:srv\n```\n\nIf you stopped this docker container you can start it again with\n\n```\nnpm run docker:start:srv\n```\n\nto start the image _gregorwolf/pg-beershop:latest_ from hub.docker.com. If you want to run your own image run che command you find in _package.json_ with your image. Finally publish the created image with:\n\n```\nnpm run push:docker\n```\n\n### Deploy to Kyma\n\nDownload the kubeconfig from your Kyma instance via the download icon in the cluster overview. Save it in _~/.kube/kubeconfig-kyma.yml_. Then run:\n\n```\nexport KUBECONFIG=~/.kube/kubeconfig-kyma.yml\n```\n\nPlease note that the token in the kubeconfig is [only valid for 8 hours](https://kyma-project.io/docs/components/security#details-iam-kubeconfig-service). So you might have to redo the download whenever you want to run the commands again.\n\nTo keep this project separate from your other deployments I would suggest to create a namespace:\n\n```\nkubectl create namespace pg-beershop\n```\n\nTo avoid `-n pg-beershop` with each kubectl command you can run:\n\n```\nkubectl config set-context --current --namespace=pg-beershop\n```\n\nDeploy the configuration:\n\n```\nkubectl -n pg-beershop apply -f deployment/beershop.yaml\n```\n\nTo create the beershop database a Job is used that starts once when you run the apply. Afterward you can delete the job with:\n\n```\nkubectl -n pg-beershop delete job beershop-db-init\n```\n\nFor troubleshooting you can SSH into the CAP container:\n\n```\nkubectl -n pg-beershop exec $(kubectl -n pg-beershop get pods -l tier=frontend -o jsonpath='{.items[0].metadata.name}') -t -i /bin/bash\n```\n\nBefore you can update the container you have to delete the beershop-db-init.\n\n```\nkubectl -n pg-beershop delete job beershop-db-init\n```\n\nThen you can run:\n\n```\nkubectl -n pg-beershop rollout restart deployment/beershop\n```\n\nIf you want to delete the deployment, then run:\n\n```\nkubectl -n pg-beershop delete -f deployment/beershop.yaml\n```\n\n## Run on Microsoft Azure\n\nInstall [Azure CLI](https://docs.microsoft.com/cli/azure/) for your respective OS.\n\nBefore you can use the CLI you have to login:\n\n```\naz login\n```\n\nIf you have multiple account you have to list them:\n\n```\naz account list\n```\n\nand then set the one you want to use:\n\n```\naz account set --subscription \u003cYour-Subscription-ID\u003e\n```\n\nWith the command:\n\n```\naz account list-locations -o table\n```\n\nyou can retrieve the list of locations and select the one fitting your needs best. You can configure the default settings for location and groups:\n\n```\naz config set defaults.location=germanywestcentral defaults.group=beershop\n```\n\nTo deploy a PostgreSQL the extension db-up needs to be installed:\n\n```\naz extension add --name db-up\n```\n\nSet the environment variables:\n\n```bash\nexport postgreservername=\u003cyourServerName\u003e\nexport adminpassword=\u003cyourAdminPassword\u003e\n```\n\nThen the PostgreSQL server and database can be created:\n\n```\naz postgres up --resource-group beershop --location germanywestcentral --sku-name B_Gen5_1 --server-name $postgreservername --database-name beershop --admin-user beershop --admin-password $adminpassword --ssl-enforcement Enabled --version 11\n```\n\nIf you want to use this database from your own location or from SAP Business Technology Platform Trial in eu10 then you have to add a firewall rule. Based on the information found in [SAP Business Technology Platform Connectivity - Network](https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-US/e23f776e4d594fdbaeeb1196d47bbcc0.html#loioe23f776e4d594fdbaeeb1196d47bbcc0__trial) I add the following rule:\n\n```\naz postgres server firewall-rule create -g beershop -s $postgreservername -n cfeu10 --start-ip-address 3.122.0.0 --end-ip-address 3.124.255.255\n```\n\nStore the DB connection information in _default-env.json_. It must contain the certificate for the TLS connection documented in [Configure TLS connectivity in Azure Database for PostgreSQL - Single Server](https://docs.microsoft.com/de-de/azure/postgresql/concepts-ssl-connection-security). The format must be the following:\n\n```json\n{\n  \"VCAP_SERVICES\": {\n    \"postgres\": [\n      {\n        \"label\": \"azure-postgresql-database\",\n        \"provider\": null,\n        \"plan\": \"database\",\n        \"name\": \"beershop-database\",\n        \"tags\": [\"PostgreSQL\"],\n        \"instance_name\": \"beershop-database\",\n        \"binding_name\": null,\n        \"credentials\": {\n          \"host\": \"\u003cyourServerName\u003e.postgres.database.azure.com\",\n          \"port\": 5432,\n          \"database\": \"beershop\",\n          \"password\": \"\u003cyourAdminPassword\u003e\",\n          \"username\": \"beershop@\u003cyourServerName\u003e\",\n          \"ssl\": {\n            \"rejectUnauthorized\": false,\n            \"ca\": \"-----BEGIN CERTIFICATE-----MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp-----END CERTIFICATE-----\"\n          },\n          \"sslRequired\": true,\n          \"tags\": [\"postgresql\"]\n        },\n        \"syslog_drain_url\": null,\n        \"volume_mounts\": []\n      }\n    ]\n  }\n}\n```\n\nConnect to the database as described in the last paragraph of _Run on SAP Business Technology Platform_.\n\nStore the file content in the environment variable VCAP_SERVICES (jq must be installed):\n\n```\nexport VCAP_SERVICES=\"$(cat default-env.json | jq .VCAP_SERVICES)\"\n```\n\nNow create the app service plan:\n\n```\naz appservice plan create --name beershop --resource-group beershop --sku F1 --is-linux\n```\n\nCheck out what Node.JS runtime is available:\n\n```\naz webapp list-runtimes --linux\n```\n\nThen create the web app:\n\n```\naz webapp create --resource-group beershop --plan beershop --name beershop --runtime \"NODE:16-lts\"\n```\n\nConfigure an environment variable the variable created before:\n\n```\naz webapp config appsettings set --name beershop --resource-group beershop --settings VCAP_SERVICES=\"$VCAP_SERVICES\"\n```\n\nNow you can publish the app using the Azure DevOps Pipeline.\n\nTo delete the database you can run:\n\n```\naz postgres server delete --resource-group beershop --name beershop\n```\n\nYou have to confirm the execution with _y_.\n\n## Run on Google Cloud Platform (GCP)\n\nInstall [Google Cloud SDK](https://cloud.google.com/sdk/docs/downloads-interactive) for your resprective OS. Then work through the [Quickstart for Node.js in the standard environment](https://cloud.google.com/appengine/docs/standard/nodejs/quickstart) to deploy\n\n```\ngcloud app create\n```\n\nStore the environment variable in _env_variables.yaml_:\n\n```YAML\nenv_variables:\n    VCAP_SERVICES: '{}'\n```\n\nThis file is included in _app.yaml_.\n\n## Use neon.tech Serverless Postgres\n\nYou can use the [neon.tech Serverless Postgres](https://neon.tech/) to run the beershop. Get the credentials after you've created a project and database. The connection information is stored in the _.cdsrc-private.json_ file:\n\n```JSON\n  \"requires\": {\n    \"[pg]\": {\n      \"db\": {\n        \"kind\": \"postgres\",\n        \"credentials\": {\n          \"host\": \"yourHost\",\n          \"port\": 5432,\n          \"user\": \"yourUser\",\n          \"password\": \"yourPassword\",\n          \"database\": \"beershop\",\n          \"ssl\": true\n        }\n      }\n    }\n  }\n```\n\n## Run on HEROKU\n\nInstall [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) for your respective OS. Then follow the instruction provided in the [Deploying with Git](https://devcenter.heroku.com/articles/git) guide to deploy from this repository.\n\nYou can also create a new pipeline or application from the Heroku website and bound it to an existing git repository. This should enable you to deploy directly from your repository on every completed pull requests on the main branch.\n\n### Create a new app\n\nStart by creating a new app and remote repository on heroku by issuing this command:\n\n```\nheroku create -a pg-beershop\n```\n\n### Setup the HEROKU POSTGRES Service\n\n[Heroku Postgres](https://devcenter.heroku.com/articles/heroku-postgresql) is a managed SQL database service provided directly by Heroku. You can access a Heroku Postgres database from any language with a PostgreSQL driver, including all languages officially supported by Heroku.\n\nIn order to provision your application with an Heroku Postgres db you have to run the following command from the CLI\n\n```\nheroku addons:create heroku-postgresql:\u003cyour_plan\u003e\n```\n\nFor the first test use\n\n```\nheroku addons:create heroku-postgresql:hobby-dev\n```\n\nWhen correctly issued this command logs the name of the newly created db instance in the console.\n\nYou can find information about plans and pricing at [this link](https://devcenter.heroku.com/articles/heroku-postgres-plans).\n\nThe best way to deploy the database schema to your heroku app db is to create it locally, using the procedure provided in the local setup section of this guide, and then push it on the remote db using the following commands:\n\n```\nPGHOST=localhost PGUSER=postgres PGPASSWORD=postgres heroku pg:push beershop \u003cremote_db_name\u003e;\n```\n\nIn order for this method to work you need to install psql locally. You can find more informations on this topic following you'll need to setup the psql command line as stated in [this link](https://devcenter.heroku.com/articles/heroku-postgresql#local-setup).\n\nNote that you don't need a running pgsql instance on your machine for this to work. You can use the psql client with the dockerized instance provided in this repository.\n\n### Configure app for running on Heroku\n\nThe entry point of every heroku application is the Procfile. Through this file you can specify the starting script of your application.\n\nCredentials for Heroku Postgres are periodically rotated by the system. An environment variable, called DATABASE_URL is provided to your application and is automatically updated on each credentials change. For this reason, you cannot use the static xml configuration provided in the package.json file, but you need to inject the connection string at runtime through the Procfile start command.\n\n```\nweb: export cds_requires_database_credentials_connectionString=$DATABASE_URL \u0026\u0026 cds run --profile heroku\n```\n\nWe used the [profile feature](https://cap.cloud.sap/docs/node.js/cds-env#profiles) in order to provide specific information for the heroku environment and suppress unwanted features from the package.json file (eg. xsuaa).\n\nWe also created a heroku-postbuild script to override the default build command when deployed to heroku (not required in this version).\n\n```json\n      \"database\": {\n        \"dialect\": \"plain\",\n        \"impl\": \"cds-pg\",\n        \"model\": [\n          \"srv\"\n        ],\n        \"credentials\": {\n          \"[heroku]\": {\n            \"ssl\": {\n              \"rejectUnauthorized\": false\n            }\n          }\n        }\n      },\n```\n\n```json\n    \"heroku-postbuild\": \"echo heroku postbuild skipped\"\n```\n\n### Authentication\n\nIn this example, we used a [custom handler](https://cap.cloud.sap/docs/node.js/authentication#custom) to mock the user authentication in the heroku environment. You can follow the guides regarding authentication on the capire website to implement your own method, or reuse the built-in jwt or basic authentication.\n\n```javascript\n// XSUAA doesn't work in heroku environment, so you should provide your own authentication handler and strategy\n// in this example, no auth method is provided\nmodule.exports = (req, res, next) =\u003e {\n  req.user = new cds.User.Privileged();\n  return next();\n};\n```\n\n### Deploy the application\n\nTo deploy the application on heroku run the command:\n\n```\ngit push heroku main\n```\n\nYou should now be able to open the beershop example from the heroku website.\n\n### Open points\n\nRight now, due to limitations in the current cds-dbm library, is not possible to use the [heroku release phase](https://devcenter.heroku.com/articles/release-phase) to automatically update the database schema on release. Will fix this when the new version of the deployer library is released.\n\n## Features\n\n### Convert SQL generated from cds compile to PostgreSQL\n\nWhen you run:\n\n```\nnpm run compile:tosql\n```\n\nthe CDS model will be compiled to the _beershop-cds.sql_ file. Using the script _cdssql2pgsql.js_ this SQL is converted to support PostgreSQL. Currently only the datatype NVARCHAR must be replaced with VARCHAR.\n\n### Import CDS files from db/data into the beershop database\n\nThe path db/data is mounted to the docker container at /tmp/data. That allows to run the COPY commands generated at the end of _beershop.sql_.\n\n## Limitations\n\n### jest tests not working yet\n\nRunning the jest test with `npm test` currently fails with:\n\n```bash\n    Failed: Object {\n      \"code\": -20005,\n      \"message\": \"Failed to load DBCAPI.\",\n      \"sqlState\": \"HY000\",\n      \"stack\": \"Error: Failed to load DBCAPI.\n```\n\nwhen running the standalone script `node test/test-db.js` that uses the same way to connect everything is OK.\n\n## Ideas\n\n### Use Init Containers to deploy schema in Kyma\n\nRight now for the Kyma deployment the schema must be updated manually. [Using Liquibase in Kubernetes](https://www.liquibase.org/blog/using-liquibase-in-kubernetes) describes the use of Init Containers in K8n. I think the Docker image [timbru31/java-node:11-erbium](https://hub.docker.com/r/timbru31/java-node) should be a good basis.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregorwolf%2Fpg-beershop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregorwolf%2Fpg-beershop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregorwolf%2Fpg-beershop/lists"}