Prisma & PlanetScale Best Practices

Поділитися
Вставка
  • Опубліковано 7 січ 2025

КОМЕНТАРІ • 41

  • @devjmetivier
    @devjmetivier 3 роки тому +24

    This is probably one of the most helpful and insightful videos from Prisma. Love it.

  • @DI3GOskill
    @DI3GOskill 2 роки тому +2

    Daniel is a great presenter, always straight to the point! just brilliant!

  • @arminbro.
    @arminbro. 2 роки тому +2

    This was super helpful! What a great breakdown of the branching flow from start to finish!

  • @moodrow1234
    @moodrow1234 2 роки тому +2

    Holy smokes. What a video. Thank you.

  • @adamalfredsson2225
    @adamalfredsson2225 Рік тому +6

    I don't understand, shouldn't you have gotten an error when merging your deploy request if there are existing rows without a value set for "updatedAt"? I might be missing the concept of Planetscale, but it would be interesting to go further into depth about how you'd write data migrations.

  • @TinoBurset
    @TinoBurset 3 роки тому +2

    Excellent video! 🙌 Glad you touched on the environments/branches handling towards the end, which I haven't seen discussed much. I've been doing almost the same, but instead of having both a preview _and_ dev branch, I just have a preview one that I use for both the preview deployments and local development. Thanks again! 🍻

    • @daniel2color
      @daniel2color 2 роки тому

      Thanks Agustin 🙌

    • @hussamkhatib746
      @hussamkhatib746 2 роки тому

      Hey Agustin, I have been figuring out the same thing.
      Is this how It's done according to what you mentioned.
      Create two db's in planetScale one for production , and staging
      in vercel two env variables are created
      - one with production checked
      - another env variable with preview and local checked (this is where you work locally and in your staging env)
      Please correct If I'm wrong

  • @MahmoudAbdelwahab
    @MahmoudAbdelwahab 3 роки тому +5

    Fantastic video! ✨

  • @vedovelli
    @vedovelli 2 роки тому +1

    What an excellent video! Thank you!

  • @haibachi
    @haibachi Рік тому

    Wish there were still a way to run non-automatic migrations. I've been using the automatic with db push for about 1.5 years but now I need to migrate data from one table to another, and have to add in my own code-based migrations, duplicating what we have with prisma migrations.

  • @darlonhenrisouza8555
    @darlonhenrisouza8555 2 роки тому +1

    Really good content

  • @Balance-8
    @Balance-8 3 роки тому +1

    Love these

  • @milon27
    @milon27 Рік тому

    i have created a database in digital ocean managed database service
    now when i use prisma to connect with it locally it works fine.
    but when i dovkerized the node js app then prisma saying not able to reach the database host p1001 error, db connection error.
    any idea how to fix it?
    i tried without prisma just mysql2 and it works in dockerized app.

  • @daviderwin1204
    @daviderwin1204 3 роки тому +1

    If I understand correctly, with this workflow we are completely foregoing the migration files that prisma generates for the planetscale diff/merging functionality. Is that correct? Is there ever an advantage to run prisma migrate incrementally, say, every minor version, to keep a record? I guess not, as if we were to move away from planetscale we would start fresh with the schema as is.

    • @daniel2color
      @daniel2color 3 роки тому +1

      That’s correct. You get a full audit log on PlanetScale.
      The reason there’s no advantage in running Migrate incrementally is that it can give you a false sense of what the migrations looked like in practice.
      Either way, you will have the full record of your Prisma schema in Git.

  • @AbdulAlim-zg8vt
    @AbdulAlim-zg8vt 2 роки тому

    Hi, I am using Prisma with for my project. Currently I am using local database. But how do i make the changes available in my production database (Digital Ocean) without data loss? I do not find any appropriate documentation. Please Help.

  • @milon27
    @milon27 Рік тому

    what about many to many implicit relationship with planetscale

  • @gsppe
    @gsppe 2 роки тому

    @Daniel Norman given that you get only one dev branch (at least in the free version) how bad of an idea would be to develop against a dockerized mysql locally and only later use the PlanetScale dev branch as a staging environment to test changes?

    • @srpenguinbr
      @srpenguinbr 2 роки тому

      any updates? I have the same doubt. I think each programmer could create it's own developtment db and ask the project manager to run the migrations from develop to main

    • @PrismaData
      @PrismaData  2 роки тому

      Hey there 👋 can you raise your issue as a GitHub Discussion, that way our Support team can take a look at it 🙌 github.com/prisma/prisma/discussions

  • @ericlif1
    @ericlif1 2 роки тому

    Thanks for this awesome video! I have a question tho: why would you want to deploy your PlanetScale DB to Vercel? Isn't PlanetScale already a Cloud DB? What does Vercel provides that PlanetScale doesn't?
    Thank you in advance!!

    • @Xexr87
      @Xexr87 2 роки тому +1

      The DB isn't being deployed to Vercel, rather the app that's utilising the DB is (likely Next JS given Vercel). Then on vercel, the necessary env variables are set so that the deployed production app can connect to the preview/main planetscale DB's.

  • @amosdottv
    @amosdottv 3 роки тому +1

    How would you handle implicit many-to-many relationships?

    • @daniel2color
      @daniel2color 3 роки тому

      Hey Amos,
      You can still define implicit m:n relations.
      Have you had any problems with those?

    • @amosdottv
      @amosdottv 3 роки тому

      @@daniel2color Since implicit many to many relationships are handled by Prisma, I was wondering how to add the indices?

    • @daniel2color
      @daniel2color 3 роки тому

      @@amosdottv Currently the way to do that for implicit many-to-many relations would be to directly define the index in the planetscale shell.

    • @gsppe
      @gsppe 2 роки тому

      @@daniel2color would it be better to go for explicit and @@index both ids?

  • @edunomatseye7262
    @edunomatseye7262 3 роки тому

    what happens when you run a "pscale deploy" command envisioning from a brach to production main, do you copy just the schema or schema with data from the branched db

    • @daniel2color
      @daniel2color 3 роки тому

      Data is never copied over when you create a deploy request or when you create a new database branch.

  • @ByteBound
    @ByteBound Рік тому

    Thanks!

  • @sakkhor
    @sakkhor 2 роки тому

    I am stuck on many to many relation in planetscale

  • @chankailoon
    @chankailoon 3 роки тому

    no more shadow branch?

    • @daniel2color
      @daniel2color 3 роки тому +1

      Since Prisma Migrate is not used, there's no need for a shadow database/branch.

  • @husseinhassan2389
    @husseinhassan2389 3 роки тому

    Can’t we have the code ?

    • @daniel2color
      @daniel2color 3 роки тому +1

      github.com/2color/prisma-planetscale

  • @cb73
    @cb73 2 роки тому +1

    "Great, it looks like it suc-seeded" (I see what you did there lol)

  • @umoooo
    @umoooo 2 роки тому

    unfornutaly planet scale doesnt let free users to make more then one branch