Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
prisma-data-migrate
Advanced tools
A CLI tool for running data migrations with Prisma in TypeScript
Prisma does not have the functionality of migrating the actual data with Typescript built in - it only allows to migrate the database schema using SQL. RedwoodJS solves that problem with data migrations, but it is specific only to Redwood applications. This package is a CLI tool for creating data migrations and applying them to any project that uses Prisma.
Install the prisma-data-migrate tool with your favorite package manager:
yarn add prisma-data-migrate
or
npm install prisma-data-migrate
You can install prisma-data-migrate globally but it's preffered to add this package to dev dependencies and then use npx to invoke commands.
In order to initialize data migrations, run:
npx prisma-data-migrate init
This command will automatically look for schema.prisma
file in the prisma directory. If it's not found, then you have to specify the path to the schema file with --schema "relative-path-to-schema"
parameter.
Prisma-migrate-schema needs a table in your database in order to store the actual state of database migrations that have been run. By default, this table is called prisma_data_migrations
but you can change that with --table "table-name"
parameter.
After initializing the prisma-data-migrate, you have to run an actual migration with Prisma migrate in order for Prisma to create the prisma_data_migrations
table. After that you're good to go!
npx prisma-data-migrate create --name "name_of_the_migration"
Creates a new data migration file with a name of choice. Name parameter is required. Also you can provide a custom path to the prisma schema file with --schema "relative-path-to-schema"
. New data migration will be created in the dataMigrations
directory which is a sibling to the prisma schema file.
npx prisma-data-migrate deploy
Deploys all the migrations that are present in the dataMigrations
directory but not saved as executed in the database.
npx prisma-data-migrate status
Returns a status of the database, whether it is up-to-date or not.
npx prisma-data-migrate status --migration "20220723130345_name_of_the_migration_file.ts"
Marks all the migrations as executed up to the selected migration (including the selected one).
FAQs
A CLI tool for running data migrations with Prisma in TypeScript
The npm package prisma-data-migrate receives a total of 2 weekly downloads. As such, prisma-data-migrate popularity was classified as not popular.
We found that prisma-data-migrate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.