Master Prisma Migrations Basics

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024

ความคิดเห็น • 16

  • @5445jedi
    @5445jedi 3 หลายเดือนก่อน +1

    Your video is well done. On a side note, and I mean this as a compliment: your voice reminds me of Javier Bardem's. HIs accent is awesome.

    • @alexrusin
      @alexrusin  3 หลายเดือนก่อน +1

      Thank you! I take it as a compliment. Javier Bardem is a great actor.

  • @guyrandalf711
    @guyrandalf711 6 หลายเดือนก่อน +1

    I love youuuuuuuuuu❤❤❤
    Thank youuuuu
    Especially for those updating columns.
    But why does it clear out when I update production?
    I already have a database in production and I just want to add one more to the enum on the orders table. When I run migrate, how do I avoid data loss?

    • @abhay7130
      @abhay7130 6 หลายเดือนก่อน

      yes same problem @alex russin

    • @alexrusin
      @alexrusin  6 หลายเดือนก่อน

      When updating a column in prisma, prisma for some reason likes to drop that column and create a new one.
      What I do is run `prisma migrate dev --create-only` for all my migrations. Then I go into migration file and review it. If necessary, I update SQL code from drop and create to rename (so I basically try to change a destructive migration to a non-destructive one). Then I run `prisma migrate dev` again to actually apply my migration.
      In production, however, you need to run `prisma migrate deploy` instead of `prisma migrate dev`

  • @miguel97-wb7co
    @miguel97-wb7co หลายเดือนก่อน +1

    dude, any comments on down migrations?? that's the only thing I came for

    • @alexrusin
      @alexrusin  หลายเดือนก่อน

      Prisma down migrations are a pain :-( www.prisma.io/docs/orm/prisma-migrate/workflows/generating-down-migrations
      When developing, if I make a mistake, I just revert manually by running reverse commands on sql and removing migration files and then updating client. In production you can just create a new migration that makes changes to fix the error. Migrations in Squelize are much better. You technically can use Prisma as your ORM and Sequelize only for migrations.

  • @hysteray
    @hysteray 3 หลายเดือนก่อน +1

    Great content! Just curious, what is your vs code theme?

    • @alexrusin
      @alexrusin  3 หลายเดือนก่อน

      Thank you. I do believe it is night owl black.

  • @BlueJersey-w2l
    @BlueJersey-w2l 6 หลายเดือนก่อน +2

    Great Content, The last Prisma Video helped me a lot to setup Prisma.

    • @alexrusin
      @alexrusin  6 หลายเดือนก่อน +1

      Glad it helped

  • @varmiguemunoz
    @varmiguemunoz หลายเดือนก่อน

    where is the repository?

    • @alexrusin
      @alexrusin  28 วันที่ผ่านมา +1

      I don't think I have a specific repository for Prisma migrations. You can check out this one: github.com/alexrusin/nextjs-prisma It has migrations.

    • @alexrusin
      @alexrusin  28 วันที่ผ่านมา

      I don't think I have a specific repository for Prisma migrations. You can check out this one: github.com/alexrusin/nextjs-prisma It has Prisma migrations.

  • @josippardon8933
    @josippardon8933 2 หลายเดือนก่อน +1

    I watched many prisma tutorials, but always ended up confused. After them, I ended up just blindly using these terminal commands hoping that i dont mistakenly use wrong one.
    Great video, thank you very much.

    • @alexrusin
      @alexrusin  2 หลายเดือนก่อน

      I'm glad it helped.