Prisma
Last updated
Was this helpful?
Last updated
Was this helpful?
It is an ORM that supports multiple database driver and contains data migration tool for migrating the data model to database via sql file to make sure the data consistency between data model and db schema
Its pattern is to grouping different data model together as a single file (schema first) , rather than separate it one by one (code first)
To execute the custom logic of seed file, the seed file will also be executed after prisma migrate dev
or prisma migrate deploy
is successful
For development only, to delete all the data and table and rerun all the migration sql file again
For development only
Reruns the existing migration history in the (second, temporary database that is created and deleted automatically)
After re-run, it will compare end state of history of shadow database and current state of database
It will use the checksum column of prisma migration table behind the scene
If detected there are diffs between state, it means that schema drift (edited or deleted migration file, or a manual changes to the database schema) are detected, you will be asked to reset your data
Applies pending migrations to the shadow database (for example, new migrations created by colleagues)
If it detects changes to the prisma schema, it generates a new migration from these changes
For production only
To apply the new migration sql file only, if it is failed , it will block the execution of other new sql file
It will compare the differences of from and to and generate the changes into one sql file
Marked the sql file history status as resolved, so that the sql file will be new and executed by deployment command
Marked the sql file history status as rolled back
It is needed to fix back the sql file manually
After rerun deployment command, the failed file will be re-run again
Directly run the sql file to the database without creating any prisma history
By using extension, you can declare the custom method to the model and apply global logic to each query, ... (AOP)
Doc: