0

I have a database (PostgreSQL) in development environment, which allows me to develop a GraphQL api in NodeJS. I would like to know how to do when I make modifications to the database, pass these modifications to staging and then to production automatically, without having to redo all the queries and so on in each environment.

Do you know how to do it? Thank you

1 Answer 1

1

A typical solution is to use something like migrations. You should have a special table that stores an information about all applied migrations.

The first migration can just execute an initial script that creates all tables, relations, functions and so on.

The subsequent migrations modify structure according to changes in your app and you always know what migrations was applied to a certain DB.

To achieve working with migration you should find a suitable package that can create, execute and undo migrations and maybe seeders as well (something like this package).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.