Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.