how to1 min readv1
Add SQL
A Slice starts on DynamoDB. Add SQL to a Slice when a feature needs integrity constraints, joins or reporting queries.
On this page
Report, then apply
bash
pnpm nx g @empire-builder-kit/nx:sql billing --reason="Invoices need foreign keys and reporting joins."
pnpm nx g @empire-builder-kit/nx:sql billing --reason="Invoices need foreign keys and reporting joins." --applyThe first command reports what would change and writes nothing. The second applies it. The reason is required and is stored with the Slice, so the next reader knows why the database exists. Neither command contacts AWS.
What changes
- The Slice gains
drizzle-orm,pgand@aws-sdk/rds-signer, and itsdata/persistence.jsondeclares SQL. - The Foundation source now declares a VPC and Aurora PostgreSQL. They are created the next time the Foundation deploys.
- Your DynamoDB tables and data stay as they are.
Deploy
Run pnpm verify, then deploy. The Foundation deploys first and creates the database; the Slice deploys after it.
Continue building