Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
prisma-data-migrate
Advanced tools
A CLI tool for running data migrations with Prisma in TypeScript
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
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.