CLICLItypeA command you run, rather than a dependency you import.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

@quadrio/cds-dbm

A published fork of cds-dbm — deploy, load, diff and drop as CDS command-line tasks for relational databases the core does not natively support.

Carries the original README and command set; the fork exists under its own org with its own release line.

Facts

Latestv0.0.41ReleasedLast pushLicenceMIT

Where it sits

Lives in
Provides
Schema evolutionCAPSchema evolutioncapabilityGetting a model change into a database that already holds data, in every tenant, without losing any of it. Generating the initial schema and migrating one that already holds data are often treated as the same step.
Flavors
Node.jsJavafrom its runtime

Who is behind it

QuadriO Beratungsgesellschaft mbHQuadriO Beratungsgesellschaft mbHOrganisationMaintains this
In the atlas: maintains 1
@QuadriO
maintainerCora BonniePersonContributes to this
In the atlas: contributes to 2
@corabonnie
David SooterPersonContributes to this
In the atlas: contributes to 9
@d-sooter
deklosdevPersonContributes to this
In the atlas: contributes to 2
@deklosdev
F7502PersonContributes to this
In the atlas: contributes to 2
@F7502
Gregor WolfPersonContributes to this
In the atlas: maintains 17, contributes to 59, wrote 2
@gregorwolf
Mike ZaschkaPersonContributes to this
In the atlas: maintains 6, contributes to 9, wrote 12
@mikezaschka
rajbhuva1PersonContributes to this
In the atlas: contributes to 3
@rajbhuva1
Sophie-Marie LückPersonContributes to this
In the atlas: contributes to 1
@sophiemarielueck
8 contributors

Before choosing this

Signals

ActivityQuietRelease and repository quiet for 39 months

Both observable publication channels have been quiet for at least 24 full months. This may be normal for stable software; check whether its current state still fits your use.

What it declares

Every artifact

Type
CLI
Origin
Independently maintained
Runtime
build time

As a CLI

Distributed through
npm

Connections2

@quadrio/cds-dbm connections@quadrio/cds-dbmFUNCTIONAL→ alternative to1alternative to authoredcds-dbm→ provides1provides authoredSchema evolution

Install

npm add @quadrio/cds-dbm

Derived from the package name. No recipe recorded; the README has the configuration.

README

quoted from quadrio/cds-dbm under MIT, read
quadrio/cds-dbm/readme.mdOn GitHub

cds-dbm (Core Data Services – Database Migrations)

cds-dbm is a package that extends the database tooling capabilities of the SAP Cloud Application Programming Model's Node.js Service SDK (@sap/cds) for relational databases other than the native supported ones (SAP HANA and SQLite).

The library offers a set of command line tasks related to deploying a cds data model to the database:

It also contains a sap/@cds builder task to create ready-to-deploy build fragments for SAP Business Technology Platform (BTP) Cloud Foundry:

Current status

cds-dbm is ready to be used!
The library contains all the necessary commands and functionality to build a cds model for and deploy it to the supported databases.

Database support

Internally cds-dbm is relying on the popular Java framework liquibase to handle (most) of the database activities. Liquibase by default has support for a variety of relational databases, but currently cds-dbm offers support for the following ones:

  • PostgreSQL (in combination with the cds-pg database adapter)

Support for other databases is planned whenever a corresponding CDS adapter library is available.

There are some example apps already using cds-dbm in combination with cds-pg:

There are also some blogposts in the SAP Community showcasing the functionality of cds-dbm:

Why does cds-dbm (currently) not support SAP HANA?

As SAP HANA is a first class citizen in CAP, SAP offers its own deployment solution (@sap/hdi-deploy). With CAP it is possible to directly compile a data model into SAP HANA fragments (.hdbtable, etc.), which can then be deployed by the hdi-deploy module taking care of all the important stuff (delta handling, hdi-management on XSA or SAP BTP, etc.).
Nevertheless it may be suitable to use the liquibase-hanadb adapter to add an alternative deployment solution. If so, support might be added in the future.


How to use

Prerequisites

Since the project uses liquibase internally, a Java Runtime Environment (JRE) in at least version 8 is required on your system.

Usage in your CAP project

Simply add this package to your CAP project by running:

npm install cds-dbm

cds-dbm requires some additional configuration added to your package.json:

  "cds": {
    //...
    "migrations": {
      "db": {
        "schema": {
          "default": "public",
          "clone": "_cdsdbm_clone",
          "reference": "_cdsdbm_ref"
        },
        "deploy": {
          "tmpFile": "tmp/_autodeploy.json",
          "undeployFile": "db/undeploy.json"
        }
      }
    }
  }

Internally cds-dbm uses 3 different schemas during deployment:

  • default – The schema containing your currently deployed and thus running schema
  • clone – A schema that will be a clone of the default schema during deployment
  • reference – The schema that will contain the CDS model

Automated delta deployments

TODO: Add full description

In the meantime some notes on the delta processing:

  1. Clone current db schema cds.migrations.db.schema.default into cds.migrations.db.schema.clone.
  2. Drop all CDS based views from clone schema because updates on views do not work in the way liquibase is handling this via CREATE OR REPLACE VIEW (https://liquibase.jira.com/browse/CORE-2377).
  3. Deploy the full CDS model to the reference schema cds.migrations.db.schema.reference.
  4. Let liquibase create a diff between the clone and reference schema (including the recreation of the dropped views).
  5. Do some adjustments on the changelog (handle undeployment stuff, fix order of things).
  6. Finally deploy changelog to current schema.
  7. Load data from .csv files (if requested).
Dropping tables/views

cds-dbm follows a safe approach and does not drop any database tables during deployment. Thus, old tables will still be around even if they are not part of your data model anymore.

You can either remove them manually or rely on cds-dbm to handle this for you.

Undeployment file

An undeployment file makes it possible to specifically list views and tables that should be dropped from the database schema during the deployment.

The undeployment file's path needs to be specified in the package.json configuration (cds.migrations.deploy.undeployFile):

# An example undeploy.json:

{
    "views": [],
    "tables": [
        "csw_beers",
        "csw_anotherTable"
    ]
}

auto-undeployment option

While an undeploy.json file gives you fine grained control, it is also possible to automatically remove tables/views from the database schema. When using the auto-undeploy flag during deployment, cds-dbm will take the cds model as the reference and remove all other existing tables/views.

Commands

The following commands exists for working with cds-dbm in the automated delta deployment mode:

Currently tall tasks must be called with npx

npx cds-dbm <task>

deploy

Performs a delta deployment of the current cds data model to the database. By default no csv files are loaded. If this is required, the load strategy has to be defined (load-via).

Usage

cds-dbm deploy

Flags

  • create-db (boolean) - If set, the deploy task tries to create the database before actually deploying the data model. The deployment will not break, if the database has already been created before.
  • auto-undeploy (boolean) - WARNING: Drops all tables not known to your data model from the database. This should only be used if your cds includes all tables/views in your db (schema). Otherwise it is highly recommended to use an undeployment file.
  • load-via (string) - Can be either full (truncate and insert) or delta (check for existing records, then update or insert)
  • dry (boolean) - Does not apply the SQL to the database but logs it to stdout

Examples

cds-dbm deploy
cds-dbm deploy --create-db
cds-dbm deploy --load-via delta
cds-dbm deploy --auto-undeploy
cds-dbm deploy --auto-undeploy --dry

load

Loads data from CSV files into the database. The following conventions apply (according to the default @sap/cds conventions at https://cap.cloud.sap/docs/guides/databases):

  • The files must be located in folders db/csv, db/data/, or db/src/csv.
  • They contain data for one entity each. File names must follow the pattern -.csv, for example, my.bookshop-Books.csv.
  • They must start with a header line that lists the needed element names.

Different to the default mechanism in @sap/cds (which supports only full loads), cds_dbm offers two loading strategies:

  • full – Truncates a table and then inserts all the data from the CSV file
  • delta – Checks, if an existing record with the same key exists and performs an update. All other records in the table will be left untouched.

Usage

cds-dbm load --via full
cds-dbm load --via delta

Flags

  • via (string) - Can be either full (truncate and insert) or delta (check for existing records, then update or insert)

drop

Drops all tables and views in your data model from the database. If the all parameter is given, then everything in the whole schema will be dropped, not only the cds specific entities.

Usage

cds-dbm drop

Flags

  • all (boolean) - If set, the whole content of the database/schema is being dropped.

Examples

cds-dbm drop
cds-dbm drop --all

diff

Generates a descriptive text containing all the differences between the defined cds model and the current status of the database. By default, the information will be logged to the console.

Usage

cds-dbm diff

Flags

  • to-file (string) - If set, the diff information will be written into the file and not logged in the console.

Examples

cds-dbm diff
cds-dbm diff --to-file db/diff.txt

Custom Build Task

Executes the defined cds build task, either from a .cdsrc or the package json. cds-dbm comes with a pre-baked build task, to deploy the data model to a PostgreSQL database on SAP BTP Cloud Foundry.

Example configuration:

"build": {
      "tasks": [
        {
          "use": "node-cf",
          "src": "srv"
        },
        {
          "use": "cds-dbm/dist/build/postgres-cf",
          "for": "postgres-cf",
          "src": "db",
          "options": {
            "deployCmd": "npx cds-dbm deploy --load-via delta --auto-undeploy"
          }
        }
      ]
    },

Usage via cds build

cds build

This will generate a specifc set of files into the gen/db (or any other configured) folder, that will be deployed to SAP BTP CF environment.

An example configuration for a mta.yml leveraging the build fragments:

  - name: devtoberfest-db-deployer
    type: custom
    path: gen/db
    parameters:
      buildpacks: [https://github.com/cloudfoundry/apt-buildpack#v0.2.2, nodejs_buildpack] 
      no-route: true
      no-start: true
      disk-quota: 2GB
      memory: 512MB
      tasks:
      - name: deploy_to_postgresql
        command: ./deploy.sh
        disk-quota: 2GB
        memory: 512MB      
    build-parameters:
      ignore: ["node_modules/"]
    requires:
      - name: devtoberfest-database 

resources:
  - name: devtoberfest-database
    parameters:
      path: ./pg-options.json
      service: postgresql-db
      service-plan: trial
      skip-service-updates:
        parameters: true
    type: org.cloudfoundry.managed-service      

Sponsors

Thank you to p36 (https://p36.io/) for sponsoring this project.

MIT, read

History

Latest

v0.0.51

  1. v0.0.50

  2. v0.0.45

  3. v0.0.44

  4. v0.0.43

  5. v0.0.42

  6. v0.0.41

  7. v0.0.40

  8. v0.0.39

  9. v0.0.38

  10. v0.0.37

  11. v0.0.36

    Features 1, Fixes 4

  12. v0.0.36

  13. v0.0.35

    Fixes 1

    Notes
    Bug Fixes
    • delta update column matching fully lowercase (4e6be32)
  14. v0.0.34

  15. v0.0.33

    Fixes 1

    Notes
    Bug Fixes
    • delta update condition now respects single records (cf180fb)
  16. v0.0.32

    Fixes 1

    Notes
    Bug Fixes
    • handle column names in csv file more save (ae2dbd4)
  17. v0.0.31

  18. v0.0.30

  19. v0.0.29

    Fixes 1

    Notes
    Bug Fixes
    • upgrade jar files to fix vulnerability (7a57d2a)
  20. v0.0.28

    Features 2, Fixes 1

    Notes
    Features
    • remove obsolete build command (f0a9c92)
    • updated @sap/cds to latest (a3b7f23)
    Bug Fixes
    • remove obsolete cds imports (a760497)
  21. v0.0.27

    Fixes 1

    Notes
    Bug Fixes
    • handle more complex cascading views correctly (7bee324)
  22. v0.0.26

    Fixes 1

    Notes
    Bug Fixes
    • only copy schema if specified in package.json (bc8cea0)
  23. v0.0.25

    Features 1, Fixes 1

    Notes
    Features
    • support for latest @sap/cds (ac6f6ad)
    Bug Fixes
    • adjust data loading to changed internal api (63db822)
  24. v0.0.24

  25. v0.0.23

  26. v0.0.22

  27. v0.0.21

  28. v0.0.20

    Features 1, Fixes 1

    Notes
    Features
    • remove not supported SQLite adapter (e0eb17d)
    Bug Fixes
    • handle dropping and creating cascading views (41cd76a)
  29. v0.0.19

  30. v0.0.18

    Features 2, Fixes 1

    Notes
    Features
    • build: add startCmd option (ba3866c)
    • diff: let diff output the diff to the console (163ee14)
    Bug Fixes
    • deploy: make ordering the changelog more robust (6694ffb), closes #6
  31. v0.0.17

    Features 1, Fixes 1

    Notes
    Features
    • build: add support for deployCmd option and copy over undeploy.json (5d0f2d3)
    Bug Fixes
    • liquibase: capture stdout in case of an error (4e46ec7)
  32. v0.0.16

    Fixes 3

    Notes
    Bug Fixes
    • build: use at least version 0.0.16 for cf deployments (b2cedbe)
    • deploy: correct java path (0503d80)
    • deploy: make deploy.sh executable (d6c7b52)
  33. v0.0.15

    Features 1, Fixes 1

    Notes
    Features
    • build: add build task for cf deployments (8b1b9f8)
    Bug Fixes
    • postgresadapter: enable before hook in deploy (99c17df)
  34. v0.0.14

    Features 2, Fixes 1

    Notes
    Features
    • deploy: add option to create a database during deployment (b5234ee)
    • deploy: remove PostgreSQL system related views from changelog (e9a29ea)
    Bug Fixes
  35. v0.0.13

    Fixes 1

    Notes
    Bug Fixes
    • PostgresAdapter: do not rely on global options which may be overwritten (c99bccb)
  36. v0.0.12

    Features 1

    Notes
    Features
    • check and create database if not available (8dddaf4)
  37. v0.0.11

    Fixes 6

    Notes
    Bug Fixes
  38. v0.0.10

  39. v0.0.9

    Fixes 1

    Notes
    Bug Fixes
    • make dry deploy runs not load data and fix console output (d1e52f0)
  40. v0.0.8

  41. v0.0.7

    Fixes 2

    Notes
    Bug Fixes
    • csv file to db name mapping (e6c1edf)
    • use regex instead of replaceAll (ecb6a7a)
  42. v0.0.6

  43. v0.0.5

    Fixes 1

    Notes
    Bug Fixes
    • add simple log statement to indicate file loading (51b3d18)
  44. v0.0.4

  45. v0.0.3

  46. v0.0.2

    Features 2, Fixes 4

    Notes
    Features
    • big update of latest developments (75c6802)
    • initial commit (38384b5)
    Bug Fixes
    • add tmp path if not available (2f8f998)
    • create changelog directories (324f44e)
    • fix tests by resetting options correctly (71a74bd)
    • fix typescript target to support node10 (0a37199)
2downloads per week, npm
Weekly downloads for @quadrio/cds-dbm26 complete calendar weeks from 2026-04-27 to 2026-10-25; the latest total is 2.27 Apr – 3 May: 94 May – 10 May: 811 May – 17 May: 1918 May – 24 May: 425 May – 31 May: 141 Jun – 7 Jun: 28 Jun – 14 Jun: 2115 Jun – 21 Jun: 3122 Jun – 28 Jun: 1229 Jun – 5 Jul: 156 Jul – 12 Jul: 5113 Jul – 19 Jul: 620 Jul – 26 Jul: 1627 Jul – 2 Aug: 123 Aug – 9 Aug: 710 Aug – 16 Aug: 917 Aug – 23 Aug: 1924 Aug – 30 Aug: 2931 Aug – 6 Sept: 97 Sept – 13 Sept: 514 Sept – 20 Sept: 1621 Sept – 27 Sept: 728 Sept – 4 Oct: 105 Oct – 11 Oct: 1712 Oct – 18 Oct: 1219 Oct – 25 Oct: 2
Declared alternative
  1. cds-dbmDelta deployment and migrations for CAP database adapters
Schema evolution
  1. @cap-js-community/commonSix CAP features in one package, from replication cache to rate limitsfrom CAP
  2. cds-dbmDelta deployment and migrations for CAP database adaptersfrom CAP
  3. @sap/cds-mtxsMultitenancy, tenant provisioning and extensibility for CAPfrom CAP
  4. @sap/cdsCAP Node.js runtimefrom CAP
  5. @sap/hdi-deployNode.js deployer for SAP HANA Deployment Infrastructure containersfrom CAP

Details

Sources4
npm registrydiscovered here, keywords:cdschecked
npm registry, @quadrio/cds-dbmversion, releases, installschecked
github.com/git+https://github.com/quadrio/cds-dbm.gittree, pushes, contributors, CIchecked
readme.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
runtimesbuild-time
latestv0.0.41
first release
releases and cadence2
discovered vianpm registry · keywords:cds
first seen in the atlas
GitHub fork ofmikezaschka/cds-dbm
ecosystem and domaincap, data-and-persistence
Contributors8
History in the atlas1
  1. First seen.
For your agent
Ref
artifact:quadrio-cds-dbm
JSON
/artifacts/quadrio-cds-dbm.json
MCP
Connecting an agent