How to manage databases in a NX workspace
Asked Answered
K

0

7

What is the best practice for managing databases in NX?

I am using Knex migrations to manage the schema of a database and would like to add this to the NX monorepo to simplify development, deployment, and add e2e tests.

Should your migration scripts live in an app, lib, tool, or elsewhere? Perhaps database management is outside the scope of NX?

Locally I am using a Postgresql docker container. In production I am using a Postgresql container in Kubernetes.

My first thought is the database would be an app in an NX workspace since the database is deployable and running nx serve locally would spin up a Postgresql container, apply the migrations, then apply database seeds for easy development.

I could not find much documentation on handling databases via NX, so I am curious as to what others are doing... the lack of documentation on databases in NX leads me to believe databases should be managed outside your monorepo. But that feels counter-intuitive.

Any insights are greatly appreciated!

Kirstenkirsteni answered 7/3, 2023 at 4:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.