0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

prisma コマンドまとめ

Posted at

prismaのコマンドをまとめます(自分用)

npx prisma init  //	prisma の初期設定
npx prisma version // prisma のバーション確認
npx prisma migrate dev //ローカル で schema をDBへ反映
npx prisma migrate dev --name <migration-name> //全体の差分を計算し、新しいマイグレーションファイルを作成
prisma migrate dev --skip-seed //seed スキップしてくれる
npx prisma migrate deploy //本番用に schema をDBへ反映
prisma migrate reset //マイグレーションのリセット(警告あり)
//マイグレーション名を指定して適用済みにする
prisma migrate resolve --applied <migration-name> 

//マイグレーション名を指定してロールバックする
prisma migrate resolve --rolled-back <migration-name> 
npx prisma db seed //マスタデータの流し込み(seedファイルにupsertなど使って作成)
npx prisma generate //prisma client の生成や TypeScript の型情報の生成
npx prisma studio //GUI操作
npx prisma introspect //既存の DB からschema.prisma を新規生成する
npx prisma db pull //既存の DB からschema.prisma を更新する
npx prisma db push //schema.prisma をもとに dbを更新する。(migration ファイルを作らない)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?