npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

prisma-data-migrate

v1.0.6

Published

<p align=center>A CLI tool for running data migrations with Prisma in TypeScript</p>

Downloads

13

Readme

Prisma-data-migrate

GitHub

Description

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.

Getting started

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!

Commands

create

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.

deploy

npx prisma-data-migrate deploy

Deploys all the migrations that are present in the dataMigrations directory but not saved as executed in the database.

status

npx prisma-data-migrate status

Returns a status of the database, whether it is up-to-date or not.

baseline

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).