Back to Browse

Mastering check constraints in Postgres to keep your database clean!

5.9K views
Jun 27, 2024
7:54

Data hygiene is important when managing a database. Postgres has build in mechanism to ensure you can only enter properly formatted data into your database using check constraints. In this video, https://twitter.com/dshukertjr shows four different ways, plus a bonus, to use check constraints to restrict what type of data can be entered into the database. Starting with numeric constraints, regex constraints for text columns, time-based constraints for timestamps and date, and using check constraints to simulate enum values. 00:00 Why we should be using check constraints 00:13 Numeric constraints 01:54 Constraints using regex 02:46 Time based constraints with timestamps and date 04:14 Using check constraints instead of enums 07:31 Lead to JSON constraints 💻 Videos to watch next: ▶ https://youtu.be/amJo48ChLGs?feature=shared ▶ https://youtu.be/bBu_V8CfWgM?feature=shared ▶ https://youtu.be/l7QBpiLRwJc?feature=shared 👇 Learn more about Supabase 👇 🕸 Website: https://supabase.com/ 🏁 Get started: https://app.supabase.com/ 📄 Docs: https://supabase.com/docs 🔔 Subscribe for more tutorials and feature updates from Supabase: https://www.youtube.com/channel/UCNTVzV1InxHV-YR0fSajqPQ?sub_confirmation=1 📱 Connect with Us: 🐙 Github: https://www.github.com/supabase 💬 Discord: https://discord.supabase.com/ 🐦 Twitter: https://www.twitter.com/supabase/ ▶ Instagram (follow for memes): https://www.instagram.com/supabasecom/ ABOUT SUPABASE: Supabase is the open source Firebase alternative. Supabase provides a full Postgres database for every project with pgvector, backups, realtime, and more. Add and manage email and password, passwordless, OAuth, and mobile logins to your project through a suite of identity providers and APIs. Build in a weekend, scale to millions. #Supabase #AppDevelopment #RealtimeApps #DeveloperTools

Download

0 formats

No download links available.

Mastering check constraints in Postgres to keep your database clean! | NatokHD