{"id":21450936,"url":"https://github.com/soontao/cds-mysql","last_synced_at":"2025-06-17T23:05:46.724Z","repository":{"id":36952587,"uuid":"336964302","full_name":"Soontao/cds-mysql","owner":"Soontao","description":"MySQL(MariaDB) adapter for CAP NodeJS Runtime","archived":false,"fork":false,"pushed_at":"2025-06-15T12:04:37.000Z","size":4030,"stargazers_count":13,"open_issues_count":11,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-15T13:20:10.541Z","etag":null,"topics":["cap","database","mysql"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Soontao.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-02-08T04:55:14.000Z","updated_at":"2025-06-15T12:04:40.000Z","dependencies_parsed_at":"2024-02-26T18:31:03.104Z","dependency_job_id":"540829d4-243d-480c-94c8-13abf140d211","html_url":"https://github.com/Soontao/cds-mysql","commit_stats":null,"previous_names":[],"tags_count":97,"template":false,"template_full_name":"Soontao/ts-project-template","purl":"pkg:github/Soontao/cds-mysql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soontao%2Fcds-mysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soontao%2Fcds-mysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soontao%2Fcds-mysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soontao%2Fcds-mysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Soontao","download_url":"https://codeload.github.com/Soontao/cds-mysql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soontao%2Fcds-mysql/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260453742,"owners_count":23011575,"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","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","database","mysql"],"created_at":"2024-11-23T04:17:15.003Z","updated_at":"2025-06-17T23:05:41.704Z","avatar_url":"https://github.com/Soontao.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cds mysql\n\n[![npm version](https://img.shields.io/npm/v/cds-mysql?label=cds-mysql)](https://www.npmjs.com/package/cds-mysql)\n[![node-test](https://github.com/Soontao/cds-mysql/actions/workflows/nodejs.yml/badge.svg)](https://github.com/Soontao/cds-mysql/actions/workflows/nodejs.yml)\n[![database-test](https://github.com/Soontao/cds-mysql/actions/workflows/database.yml/badge.svg)](https://github.com/Soontao/cds-mysql/actions/workflows/database.yml)\n\n[![codecov](https://codecov.io/gh/Soontao/cds-mysql/branch/main/graph/badge.svg?token=xTt6AaHeuu)](https://codecov.io/gh/Soontao/cds-mysql)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=Soontao_cds-mysql\u0026metric=security_rating)](https://sonarcloud.io/dashboard?id=Soontao_cds-mysql)\n[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=Soontao_cds-mysql\u0026metric=sqale_index)](https://sonarcloud.io/dashboard?id=Soontao_cds-mysql)\n[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=Soontao_cds-mysql\u0026metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=Soontao_cds-mysql)\n\n\u003e `MySQL`/`MariaDB` adapter for [CAP Framework](https://cap.cloud.sap/docs/about/), this module is heavily inspired by the [cds-pg](https://github.com/sapmentors/cds-pg) module.\n\n## Setup\n\nfirstly, install npm packages\n\n```bash\nnpm i cds-mysql mysql2\n```\n\nsetup the `mysql` database driver for cds -\u003e edit the `package.json` \u003e `cds` node (or `.cdsrc.json`)\n\n```json\n{\n  \"requires\": {\n    \"db\": {\n      \"kind\": \"mysql\"\n    }\n  }\n}\n```\n\ncreate an `.env` file and put that into your local CDS project, then fill the database credential\n\n```bash\nCDS_REQUIRES_DB_CREDENTIALS_HOST=127.0.0.1\nCDS_REQUIRES_DB_CREDENTIALS_PORT=3306\nCDS_REQUIRES_DB_CREDENTIALS_DATABASE= # db name\nCDS_REQUIRES_DB_CREDENTIALS_USER= # db user\nCDS_REQUIRES_DB_CREDENTIALS_PASSWORD= # db user pwd!\n```\n\nnow, start the cds server (`npx cds-serve`), everything is ready!\n\n\u003e [!TIP]\n\u003e read more about how to config [database credential](./docs/ADVANCED_USAGE.md#configure-database-credential-by-environments-variables).\n\n\u003e [!TIP]\n\u003e read more about how to setup [database user](./docs/ADVANCED_USAGE.md#database).\n\n---\n\nin addition, please check [cap-mysql-sflight](https://github.com/Soontao/cap-mysql-sflight) to get the `mysql` version of official `cap-sflight` example, and it works well.\n\n## [Advanced Documentation](./docs/ADVANCED_USAGE.md)\n\nplease read the full long version [Advanced Documentation](./docs/ADVANCED_USAGE.md) to get more technical details.\n\n## Feature and RoadMap\n\n- [x] fundamental `INSERT`/`UPDATE`/`DELETE`/`SELECT` query support\n  - [x] support [`UPSERT`](./docs/ADVANCED_USAGE.md#upsert) by `INSERT ... ON DUPLICATE KEY UPDATE` statement\n- [x] deep insert for association/composition\n  - [x] deep create/update/query/delete test case\n- [x] `fiori` draft support\n  - [x] `draftPrepare`/`draftEdit`/`draftActivate` test case\n- [x] `temporal` aspect, but not support [time-travel query](https://cap.cloud.sap/docs/guides/temporal-data#time-travel-queries)\n- [x] `incrementID` auto incremental key aspect\n- [x] `preDelivery` CSV aspect\n  - [x] migrate CSV on-demand (with option)\n  - [x] CSV migration with hash check\n  - [ ] care entity dependencies - the order of CSV import\n- [x] full text search\n- [x] schema migration optimization (ignore drop in some case)\n  - [ ] ignore column length reduce and with warning\n  - [x] model version, only incremental migration - `transparent migration`\n- [x] [`@Core.Media` attachment support](https://cap.cloud.sap/docs/guides/media-data)\n- [x] [localized data](https://cap.cloud.sap/docs/guides/localized-data)\n- [x] multi tenancy\n  - [x] deploy model on-fly\n  - [x] create database on-demand\n    - [ ] user permission check\n  - [x] _experimental_ [`@sap/cds-mtxs` support](https://cap.cloud.sap/docs/guides/multitenancy/mtxs) -\u003e [document](./docs/MTXS.md) - behavior maybe changed later.\n    - [x] extensibility (`pull`/`push`)\n- [x] `$expand` navigation\n- [x] `$filter` with canonical functions (`concat`/`contains`/`substring`)\n- [x] test with `mariadb 10`, `mysql 5/8`\n- [x] initial data provision by `CSV`\n  - [x] better migration type/column/name adaption\n- [x] mysql index\n  - [ ] better error for not supported elements\n- [x] automatically schema sync (when connection pool provision)\n- [x] SELECT [`FOR UPDATE`](https://cap.cloud.sap/docs/node.js/cds-ql?q=forUpdate#select-forUpdate)/`LOCK IN SHARE MODE`\n  - [ ] `NOWAIT` support\n  - [ ] `SKIP LOCKED` support\n- [x] better E2E document/sample - [cap-mysql-sflight](https://github.com/Soontao/cap-mysql-sflight)\n- [ ] adapt new cds-dbs layer\n- [ ] real stream adoption for binary\n\n## [CHANGELOG](./CHANGELOG.md)\n\n## [LICENSE](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoontao%2Fcds-mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoontao%2Fcds-mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoontao%2Fcds-mysql/lists"}