Mastering check constraints in Postgres to keep your database clean!

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

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

  • @dshukertjr
    @dshukertjr 2 หลายเดือนก่อน +9

    The one with date column example was my favorite! Which example was your favorite? Do you have other ways you are utilizing check constraints? Let us know in the comments 👇

  • @Trashmanatx
    @Trashmanatx 2 หลายเดือนก่อน +9

    Holy cow... I can't believe this kind of content is coming from the actual team that is making the software/service. Keep up the great work!

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

      A lot more Postgres content coming from the Supabase team 💪

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

      Right? This is rare. We appreciate

  • @mrrolandlawrence
    @mrrolandlawrence 2 หลายเดือนก่อน +3

    Keeping the rules in the sql datastore. This makes me happy.

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

    Love the content. It should be said that not everything needs to be constrained at the DB level. It’s not extensible.

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

      Every usecase has a different solution for sure, and every solution has its pros and cons. What do you mean extensible here?

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

      @@dshukertjrI also would put my constraints in my code, so a user will get the right message in the right text box while adding data, instead of throwing a db exception on submit

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

      @@MennoB-sk8tv Yeah, you should always add the same constraint on your frontend code for maximum user experience!

    • @MennoB-sk8tv
      @MennoB-sk8tv 2 หลายเดือนก่อน

      @@dshukertjr yes cbut i would like to write things just once for maintainability

  • @EmielvanGoor
    @EmielvanGoor 2 หลายเดือนก่อน +5

    Thanks for the video, i learn a lot from them... Keep it up please! Kudo's on the quality, really good!

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

      Glad to hear it's helping you out! I'm also learning a lot through creating these videos! Thanks for such a nice comment!

  • @ryanmouritz
    @ryanmouritz 2 หลายเดือนก่อน +4

    Perfectly timed. I was only wondering last night whether I should add enums for my Web app or use constraints

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

      Right on time!

  • @nerrydanna
    @nerrydanna 2 หลายเดือนก่อน +3

    Very interesting! Thanks

  • @aham_sammich
    @aham_sammich 2 หลายเดือนก่อน +3

    Super useful! Thank you! 🙌🏾

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

      Glad to hear that you liked it!

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

    Man, I love postgresql.

  • @kamil_supabase_enjoyer
    @kamil_supabase_enjoyer 2 หลายเดือนก่อน +3

    ❤❤❤

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

    I liked those simple and clean exemples.
    But for the enums part, while what you have shown seems convenient from a migration point of view, you loose the generated typings no?

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

      Yes, that is one thing you lose, but it's not that hard to modify your generated Typescript file to add those types manually. Also, if you prefer to just keep using enums, that is totally fine too.

  • @akash-kumar737
    @akash-kumar737 หลายเดือนก่อน

    Check for enums is best

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

    ts support pls

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

      For the enum?

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

      ​@@Supabase Nah, for the check constraints. (type gen)