Skip to content

Commit

Permalink
Update README and generated_classes to recommend lowercase enum value…
Browse files Browse the repository at this point in the history
…s and change USERGROUP enum to uppercase
  • Loading branch information
mmvergara committed Dec 20, 2024
1 parent b28e293 commit 40bcabc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,12 @@ await supabase.books.delete().eq(Books.c_id, 1);

- You need to specify your enums on supadart.yaml config file
- Enum `names` are converted to `UPPERCASE` to follow dart enum naming conventions
- Enum `values` are converted to `LOWERCASE` to follow dart enum naming conventions
- Optional: We recommend defining the enum values as lowercase to follow dart enum naming conventions

Assuming the following schema

```sql
-- We recommend defining the enum values as lowercase to follow dart enum naming conventions
CREATE TYPE mood AS ENUM ('happy', 'sad', 'neutral', 'excited', 'angry');
CREATE TABLE enum_types (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
Expand Down
2 changes: 1 addition & 1 deletion cli/test/models/generated_classes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ extension SupadartStorageClient on SupabaseStorageClient {}
// Enums
enum MOOD { happy, sad, neutral, excited, angry }

enum USERGROUP { users, admin, moderator }
enum USERGROUP { USERS, ADMIN, MODERATOR }

// Utils
extension DurationFromString on Duration {
Expand Down

0 comments on commit 40bcabc

Please sign in to comment.