{"_id":"@aws/aurora-dsql-prisma-tools","_rev":"3-6f4848ae5bd3f69950ec51b40ab11d7b","name":"@aws/aurora-dsql-prisma-tools","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@aws/aurora-dsql-prisma-tools","version":"0.1.0","keywords":["prisma","aurora","dsql","aws","database","postgresql"],"author":{"name":"Amazon Web Services"},"license":"Apache-2.0","_id":"@aws/aurora-dsql-prisma-tools@0.1.0","maintainers":[{"name":"aws-aurora-dsql-devex","email":"dsql-dev-ex@amazon.com"}],"homepage":"https://github.com/awslabs/aurora-dsql-orms#readme","bugs":{"url":"https://github.com/awslabs/aurora-dsql-orms/issues"},"bin":{"aurora-dsql-prisma":"dist/cli/index.js"},"dist":{"shasum":"4d330739af6d36a121f6785a401166c393c4f760","tarball":"https://registry.npmjs.org/@aws/aurora-dsql-prisma-tools/-/aurora-dsql-prisma-tools-0.1.0.tgz","fileCount":14,"integrity":"sha512-puTZMwB9lmDoWzazgDQ3wwFg+3BCfFuMi8s+LPMdEPMU8BLXYElGNqzMcY/kt/OOWZMVtuxv/+KQVhB1tJerxQ==","signatures":[{"sig":"MEYCIQD/+gXO45bzXTpPKZj6Tpu1ZQaxbpyvFK4KQc9/DP21AAIhAPgzXQ4SheIzig/+p8WOu5rPaZYpKOLLlIy9lXeb3DZ9","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aws%2faurora-dsql-prisma-tools@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":61930},"main":"dist/cli/index.js","types":"./dist/cli/index.d.ts","engines":{"node":">=20"},"gitHead":"6175db2735ad2fde76c769ac927e8435dc387730","scripts":{"test":"NODE_OPTIONS='--experimental-vm-modules' jest","build":"tsc","format":"prettier --write .","pretest":"npm run build","validate":"tsx src/cli/index.ts validate","dsql-migrate":"tsx src/cli/index.ts migrate","format:check":"prettier --check .","dsql-transform":"tsx src/cli/index.ts transform"},"_npmUser":{"name":"aws-aurora-dsql-devex","email":"dsql-dev-ex@amazon.com"},"comments":{"overrides":{"hono":"CVE-2026-24472 - Remove when prisma updates to hono >=4.11.7","lodash":"CVE-2025-13465 - Remove when prisma updates to lodash >=4.17.23"}},"overrides":{"hono":"^4.11.7","lodash":"^4.17.23"},"repository":{"url":"git+https://github.com/awslabs/aurora-dsql-orms.git","type":"git","directory":"node/prisma"},"_npmVersion":"10.9.4","description":"CLI tools for using Prisma with Amazon Aurora DSQL","directories":{},"_nodeVersion":"22.22.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.20.3","prisma":"^7.3.0","ts-jest":"^29.4.1","prettier":"4.0.0-alpha.13","typescript":"^5.8.3","@types/jest":"^30.0.0","@types/node":"^25.2.0","@aws-sdk/dsql-signer":"^3.980.0"},"_npmOperationalInternal":{"tmp":"tmp/aurora-dsql-prisma-tools_0.1.0_1770078995109_0.6842196450599887","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@aws/aurora-dsql-prisma-tools","version":"0.1.2","keywords":["prisma","aurora","dsql","aws","database","postgresql"],"author":{"name":"Amazon Web Services"},"license":"Apache-2.0","_id":"@aws/aurora-dsql-prisma-tools@0.1.2","maintainers":[{"name":"aws-aurora-dsql-devex","email":"dsql-dev-ex@amazon.com"}],"homepage":"https://github.com/awslabs/aurora-dsql-orms#readme","bugs":{"url":"https://github.com/awslabs/aurora-dsql-orms/issues"},"bin":{"aurora-dsql-prisma":"dist/cli/index.js"},"dist":{"shasum":"66db6cd2959b9de4d90e94c61bfdcd857340a5f1","tarball":"https://registry.npmjs.org/@aws/aurora-dsql-prisma-tools/-/aurora-dsql-prisma-tools-0.1.2.tgz","fileCount":18,"integrity":"sha512-5cwDrOLoXfD74153gGLH6pvTjp/7Qgul07sPl8kbbaboTkbKul4L02xl/2CfD/B/VqLMMoArQHO6zvx4FPzb6Q==","signatures":[{"sig":"MEUCIEXR5w9wPfn62QU9oA8h6lP/8RtrradLGeTQuvjDsjliAiEAjSXckWIfEpD3GiQ5q2qKlOnwEd+TF8GarIXK0cC3slw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aws%2faurora-dsql-prisma-tools@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":54600},"main":"dist/cli/index.js","types":"./dist/cli/index.d.ts","engines":{"node":">=20"},"gitHead":"3f290a62a27996978edecfe29916d0b1f8368d75","scripts":{"test":"NODE_OPTIONS='--experimental-vm-modules' jest","build":"tsc","format":"prettier --write .","pretest":"npm run build","validate":"tsx src/cli/index.ts validate","dsql-lint":"tsx src/cli/index.ts lint","dsql-migrate":"tsx src/cli/index.ts migrate","format:check":"prettier --check .","dsql-transform":"tsx src/cli/index.ts transform"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:dd21f35f-6fba-439c-a268-71f71688393d"}},"comments":{"overrides":{"hono":"CVE-2026-24472 - Remove when prisma updates to hono >=4.11.10","lodash":"CVE-2025-13465 - Remove when prisma updates to lodash >=4.17.23","fast-xml-parser":"Stack overflow in XMLBuilder - Remove when @aws-sdk/xml-builder updates to fast-xml-parser >=5.3.8"}},"overrides":{"hono":"^4.11.10","lodash":"^4.17.23","fast-xml-parser":"^5.4.1"},"repository":{"url":"git+https://github.com/awslabs/aurora-dsql-orms.git","type":"git","directory":"node/prisma"},"_npmVersion":"11.5.1","description":"CLI tools for using Prisma with Amazon Aurora DSQL","directories":{},"_nodeVersion":"22.22.2","dependencies":{"@aws/dsql-lint":"^0.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.20.3","prisma":"^7.3.0","ts-jest":"^29.4.1","prettier":"4.0.0-alpha.13","typescript":"^5.8.3","@types/jest":"^30.0.0","@types/node":"^25.2.0","@aws-sdk/dsql-signer":"^3.980.0"},"_npmOperationalInternal":{"tmp":"tmp/aurora-dsql-prisma-tools_0.1.2_1778699554272_0.7494390643294135","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"_id":"@aws/aurora-dsql-prisma-tools@0.1.3","bin":{"aurora-dsql-prisma":"dist/cli/index.js"},"bugs":{"url":"https://github.com/awslabs/aurora-dsql-orms/issues"},"dist":{"shasum":"967f93c834bf621c8046d591c7dd4aa36f0b00f0","tarball":"https://registry.npmjs.org/@aws/aurora-dsql-prisma-tools/-/aurora-dsql-prisma-tools-0.1.3.tgz","fileCount":18,"integrity":"sha512-7PuDAD35zBNkzNNjraFioPPsWh+wKRepGpdv7AOqAZmv4MevecwQ517wlpDp13HBQvakSITA02lIFu4epHTpLw==","signatures":[{"sig":"MEUCIQCfJzn5zNNLYHNSG4i5q437hsaKrl+15t/aWbgrGjVlfAIgaexdaYdwJbF3iHQXxbgxmq3AaS/Klp2U01miS/jdNuk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCyhzdiF5iRwGVvzDl1BAYUPLSeOFo4SuEyLppfHrnl7gIgZ2BP76m3wMxiF8JQeIJ5CQ8aljzCqtjAof/f7NeOHGY="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aws%2faurora-dsql-prisma-tools@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":56838},"main":"dist/cli/index.js","name":"@aws/aurora-dsql-prisma-tools","types":"./dist/cli/index.d.ts","author":{"name":"Amazon Web Services"},"engines":{"node":">=20"},"gitHead":"6723c07c69a95e5fa3c10fb5cc602f0110003b35","license":"Apache-2.0","scripts":{"test":"NODE_OPTIONS='--experimental-vm-modules' jest","build":"tsc","format":"prettier --write .","pretest":"npm run build","validate":"tsx src/cli/index.ts validate","dsql-lint":"tsx src/cli/index.ts lint","dsql-migrate":"tsx src/cli/index.ts migrate","format:check":"prettier --check .","dsql-transform":"tsx src/cli/index.ts transform"},"version":"0.1.3","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:dd21f35f-6fba-439c-a268-71f71688393d"}},"comments":{"overrides":{"hono":"CVE-2026-24472 - Remove when prisma updates to hono >=4.11.10","lodash":"CVE-2025-13465 - Remove when prisma updates to lodash >=4.17.23","js-yaml":"Quadratic-complexity DoS in merge key handling - Remove when ts-jest's @istanbuljs/load-nyc-config updates js-yaml >=3.15.0","fast-xml-parser":"Stack overflow in XMLBuilder - Remove when @aws-sdk/xml-builder updates to fast-xml-parser >=5.3.8"}},"homepage":"https://github.com/awslabs/aurora-dsql-orms#readme","keywords":["prisma","aurora","dsql","aws","database","postgresql"],"overrides":{"hono":"^4.11.10","lodash":"^4.17.23","js-yaml":"^3.15.2","fast-xml-parser":"^5.4.1"},"repository":{"url":"git+https://github.com/awslabs/aurora-dsql-orms.git","type":"git","directory":"node/prisma"},"_npmVersion":"11.5.1","description":"CLI tools for using Prisma with Amazon Aurora DSQL","directories":{},"maintainers":[{"name":"aws-aurora-dsql-devex","email":"dsql-dev-ex@amazon.com"}],"_nodeVersion":"22.23.2","dependencies":{"@aws/dsql-lint":"latest"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.20.3","prisma":"^7.3.0","ts-jest":"^29.4.1","prettier":"4.0.0-alpha.13","typescript":"^5.8.3","@types/jest":"^30.0.0","@types/node":"^26.5.1","@aws-sdk/dsql-signer":"^3.980.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/aurora-dsql-prisma-tools_0.1.3_1789773975210_0.07926754267167535"}}},"time":{"created":"2026-02-03T00:36:34.992Z","modified":"2026-09-18T23:26:15.643Z","0.1.0":"2026-02-03T00:36:35.241Z","0.1.2":"2026-05-13T19:12:34.463Z","0.1.3":"2026-09-18T23:26:15.277Z"},"bugs":{"url":"https://github.com/awslabs/aurora-dsql-orms/issues"},"author":{"name":"Amazon Web Services"},"license":"Apache-2.0","homepage":"https://github.com/awslabs/aurora-dsql-orms#readme","keywords":["prisma","aurora","dsql","aws","database","postgresql"],"repository":{"url":"git+https://github.com/awslabs/aurora-dsql-orms.git","type":"git","directory":"node/prisma"},"description":"CLI tools for using Prisma with Amazon Aurora DSQL","maintainers":[{"name":"aws-aurora-dsql-devex","email":"dsql-dev-ex@amazon.com"}],"readme":"# Aurora DSQL Tools for Prisma\n\n[![GitHub](https://img.shields.io/badge/github-awslabs/aurora--dsql--orms-blue?logo=github)](https://github.com/awslabs/aurora-dsql-orms)\n[![npm version](https://img.shields.io/npm/v/@aws/aurora-dsql-prisma-tools.svg)](https://www.npmjs.com/package/@aws/aurora-dsql-prisma-tools)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Discord chat](https://img.shields.io/discord/1435027294837276802.svg?logo=discord)](https://discord.com/invite/nEF6ksFWru)\n\nCLI tools for using [Prisma ORM](https://www.prisma.io/) with [Amazon Aurora DSQL](https://docs.aws.amazon.com/aurora-dsql/latest/userguide/what-is-aurora-dsql.html).\n\n## Overview\n\nThis package provides:\n\n1. **Schema Validator** - Validates Prisma schemas for DSQL compatibility\n2. **Migration Transformer** - Converts Prisma migrations to DSQL-compatible SQL using [`dsql-lint`](https://github.com/awslabs/aurora-dsql-tools/tree/main/dsql-lint)\n3. **Migration Linter** - Checks SQL migrations for DSQL compatibility without modifying them\n4. **All-in-one Migrate Command** - Validates, generates, and transforms in one step\n\nAurora DSQL has [specific PostgreSQL compatibility limitations](https://docs.aws.amazon.com/aurora-dsql/latest/userguide/working-with-postgresql-compatibility-unsupported-features.html). These tools help you catch issues early and automate the required transformations.\n\n## Installation\n\n```bash\nnpm install --save-dev @aws/aurora-dsql-prisma-tools\n```\n\n**Supported Node.js versions:** 20+ (Active and LTS releases)\n\n`@aws/dsql-lint` is included using npm's `latest` dist-tag and uses its bundled\nbinary by default (no setup required). Fresh dependency resolution installs the\ncurrent release; existing lockfiles keep their recorded version until the\ndependency is updated or the lockfile is regenerated. To use a custom or\nexisting installation, set `DSQL_LINT_PATH`.\n\n## Quick Start\n\nGenerate a DSQL-compatible migration in one command:\n\n```bash\nnpx aurora-dsql-prisma migrate prisma/schema.prisma -o prisma/migrations/001_init/migration.sql\n```\n\nIf validation fails, fix your schema and re-run.\n\n## Commands\n\n### Validate Schema\n\nCheck your Prisma schema for DSQL compatibility before runtime:\n\n```bash\nnpx aurora-dsql-prisma validate prisma/schema.prisma\n```\n\n#### What the Validator Checks\n\nThe validator generates SQL from your schema and delegates compatibility checks\nto [`dsql-lint --fix`](https://github.com/awslabs/aurora-dsql-tools/tree/main/dsql-lint),\nthe same path used to transform migrations. Transformable SQL passes validation\nwith advisories; unfixable SQL fails. `relationMode = \"prisma\"` remains useful\nfor automated migrations, but is no longer mandatory.\n\n#### Example Output\n\n```\n⚠ Column `\"id\"` uses SERIAL, which is not supported in DSQL.\n  → Replaced SERIAL with a DSQL-compatible identity column.\n\n✓ Validation passed with 1 advisory\n```\n\n### Transform Migrations\n\nTransform Prisma-generated migrations to be DSQL-compatible:\n\n```bash\n# Transform from file\nnpx aurora-dsql-prisma transform raw.sql -o migration.sql\n\n# Transform using pipes (stdin)\nnpx prisma migrate diff \\\n    --from-empty \\\n    --to-schema prisma/schema.prisma \\\n    --script | npx aurora-dsql-prisma transform > migration.sql\n```\n\n#### What the Transformer Does\n\nThe transform command uses [`dsql-lint --fix`](https://github.com/awslabs/aurora-dsql-tools/tree/main/dsql-lint) to apply DSQL compatibility fixes. See the [dsql-lint README](https://github.com/awslabs/aurora-dsql-tools/tree/main/dsql-lint) for the full list of rules and transformations.\n\n### Lint Migrations\n\nCheck a SQL migration file for DSQL compatibility without applying fixes:\n\n```bash\nnpx aurora-dsql-prisma lint migration.sql\n```\n\n### All-in-One Migrate\n\nValidate, generate, and transform in one step:\n\n```bash\nnpx aurora-dsql-prisma migrate prisma/schema.prisma -o prisma/migrations/001_init/migration.sql\n```\n\nFor incremental migrations against an existing database:\n\n```bash\nnpx aurora-dsql-prisma migrate prisma/schema.prisma \\\n    -o prisma/migrations/002_add_column/migration.sql \\\n    --from-config-datasource\n```\n\n## Incremental Migrations\n\nAfter your initial deployment, use `--from-config-datasource` to generate migrations that only include differences from the live database:\n\n```bash\nnpx aurora-dsql-prisma migrate prisma/schema.prisma \\\n    -o prisma/migrations/002_add_email/migration.sql \\\n    --from-config-datasource\n```\n\nThis requires a `prisma.config.ts` that provides database credentials. See the [example](examples/veterinary-app/) for a working implementation.\n\n### Handling Unsupported Statements\n\nPrisma generates post-creation foreign keys with `ALTER TABLE ... ADD\nCONSTRAINT`. Aurora DSQL requires `NOT VALID` on these constraints, so\n`dsql-lint` preserves the foreign key and adds `NOT VALID`. Add a separate\nstatement to validate existing rows:\n\n```sql\nALTER TABLE ASYNC \"table_name\" VALIDATE CONSTRAINT \"constraint_name\";\n```\n\nThe transform exits with code `3` to ensure you review and add the validation\nstatement. The constraint applies to new writes immediately, but existing rows\nremain unvalidated until the asynchronous job completes.\n\n## Prisma Schema Requirements\n\nWhen using Prisma with Aurora DSQL:\n\n1. **Choose a relation mode**:\n\n   ```prisma\n   datasource db {\n     provider     = \"postgresql\"\n     relationMode = \"prisma\"\n   }\n   ```\n\n   Use `relationMode = \"prisma\"` when the application should emulate\n   referential integrity. To use native DSQL foreign keys, omit it. Aurora DSQL\n   supports `NoAction`, `Restrict`, `Cascade`, `SetNull`, and `SetDefault`.\n   Post-creation constraints are transformed to `NOT VALID`; add the\n   corresponding `ALTER TABLE ASYNC ... VALIDATE CONSTRAINT` statement before\n   applying the migration.\n\n   Cascading actions count toward Aurora DSQL's transaction row-modification\n   limits. Prefer `NoAction` or `Restrict` where child-row cardinality is\n   unbounded, and run transactions through retry handling because foreign-key\n   conflicts can surface as serialization failures.\n\n2. **Use UUID for IDs**:\n\n   ```prisma\n   model User {\n     id String @id @default(dbgenerated(\"gen_random_uuid()\")) @db.Uuid\n   }\n   ```\n\n3. **Disable advisory locks** - When running migrations:\n   ```bash\n   PRISMA_SCHEMA_DISABLE_ADVISORY_LOCK=1 npx prisma migrate deploy\n   ```\n\nFor the full list of Aurora DSQL SQL compatibility details, see the [PostgreSQL compatibility reference](https://docs.aws.amazon.com/aurora-dsql/latest/userguide/working-with-postgresql-compatibility.html).\n\n## Example\n\nSee [examples/veterinary-app/](examples/veterinary-app/) for a complete working example including:\n\n- DSQL-compatible Prisma schema\n- DsqlPrismaClient with automatic IAM authentication\n- Sample CRUD operations\n- Integration tests\n\n## Additional Resources\n\n- [Amazon Aurora DSQL Documentation](https://docs.aws.amazon.com/aurora-dsql/latest/userguide/what-is-aurora-dsql.html)\n- [Unsupported PostgreSQL Features in DSQL](https://docs.aws.amazon.com/aurora-dsql/latest/userguide/working-with-postgresql-compatibility-unsupported-features.html)\n- [Aurora DSQL Connector for node-postgres](https://github.com/awslabs/aurora-dsql-connectors/tree/main/node/node-postgres/)\n- [Prisma Documentation](https://www.prisma.io/docs)\n- [Prisma Relation Mode](https://www.prisma.io/docs/orm/prisma-schema/data-model/relations/relation-mode)\n\n## Security\n\nSee [CONTRIBUTING](../../CONTRIBUTING.md#security-issue-notifications) for more information.\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n","readmeFilename":"README.md"}