From the course: Supabase Essential Training

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Enum fields

Enum fields

- [Instructor] PostgreSQL provides a lot of options for column types. But what if you want something that's even more specific? Let's say we wanted to add a heat column to the items table to track stovetop cooking temperatures. We would only want values like low, medium low, medium, medium high and high. We don't want to set a specific temperature because that's not commonly supported on cooktops. Instead, we want an enumerated type or an enum for short. This enum will include just those five options and nothing else. Once we've defined that enum, then we can add it as a column here in the items table. First, go to the database section and then go to enumerated types. And now we're going to define this type. We're in the public schema, and that way it'll be accessible to our table. And I'm going to create this type. I'm going to name it heat, and I'm going to describe it as stovetop cooking temperatures. And now I'm…

Contents