Search code examples
prisma

Prisma CLI command like Django's `makemigrations --check`


In CI(GitHub Actions), I want to check if schema changed without migration generated. There is exact command what I want in Django, ./manage.py makemigrations --check, but I cannot found such command in Prisma.

https://docs.djangoproject.com/en/4.1/ref/django-admin/#cmdoption-makemigrations-check

What would be the best way to check ungenerated migration with Prisma?


Solution

  • Depending on what exactly you want to compare you can use prisma migrate diff for this.

    prisma migrate diff --from-schema-datamodel --to-schema-datasource --exit-code

    prisma migrate diff --from-migrations --to-schema-datasource --exit-code

    prisma migrate diff --from-migrations --to-schema-datamodel --exit-code

    This will compare the state of the two sides with each other. If they are the same it will exit with 0 if there are differences with 2.

    See the command docs here: https://www.prisma.io/docs/reference/api-reference/command-reference#migrate-diff