You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- MUST DO! Any changes to database - adding queries, modifying queries should be done in the `coderd/database/queries/*.sql` files
95
+
- MUST DO! Queries are grouped in files relating to context - e.g. `prebuilds.sql`, `users.sql`, `oauth2.sql`
96
+
- After making changes to any `coderd/database/queries/*.sql` files you must run `make gen` to generate respective ORM changes
97
+
98
+
3.**Handle nullable fields**:
99
+
- Use `sql.NullString`, `sql.NullBool`, etc. for optional database fields
100
+
- Set `.Valid = true` when providing values
101
+
- Example:
102
+
103
+
```go
104
+
CodeChallenge: sql.NullString{
105
+
String: params.codeChallenge,
106
+
Valid: params.codeChallenge != "",
107
+
}
108
+
```
67
109
68
-
- MUST DO! Any changes to database - adding queries, modifying queries should be done in the `coderd\database\queries\*.sql` files. Use `make gen` to generate necessary changes after.
69
-
- MUST DO! Queries are grouped in files relating to context - e.g. `prebuilds.sql`, `users.sql`, `provisionerjobs.sql`.
70
-
- After making changes to any `coderd\database\queries\*.sql` files you must run `make gen` to generate respective ORM changes.
110
+
4. **Audit table updates**:
111
+
- If adding fields to auditable types, update `enterprise/audit/table.go`
112
+
- Add each new field with appropriate action (ActionTrack, ActionIgnore, ActionSecret)
113
+
- Run`make gen` to verify no audit errors
114
+
115
+
### DatabaseGenerationProcess
116
+
117
+
1. ModifySQL files in `coderd/database/queries/`
118
+
2. Run`make gen`
119
+
3. If errors about audit table, update `enterprise/audit/table.go`
0 commit comments