Commit 9230411
authored
refactor(sponsor-panel): migrate from raw SQL to GORM (#1183)
* refactor(sponsor-panel): rewrite models with GORM tags and helpers
Replace raw pgxpool structs and SQL helper functions with GORM-tagged
models. Rename User to PanelUser to avoid collision with internal/models.
All DB helpers now take *gorm.DB instead of context + *pgxpool.Pool.
Add TableName() methods and PanelModels() for AutoMigrate.
Assisted-by: Claude Opus 4.6 via Claude Code
Signed-off-by: Xe Iaso <me@xeiaso.net>
* refactor(sponsor-panel): remove raw SQL migrations
GORM AutoMigrate replaces hand-written CREATE TABLE statements
and ALTER TABLE migrations.
Assisted-by: Claude Opus 4.6 via Claude Code
Signed-off-by: Xe Iaso <me@xeiaso.net>
* refactor(sponsor-panel): swap pgxpool for gorm.DB in server
Replace pgxpool.Pool with gorm.DB on Server struct. Use slog-gorm
for structured logging and gorm-prometheus for database metrics.
Assisted-by: Claude Opus 4.6 via Claude Code
Signed-off-by: Xe Iaso <me@xeiaso.net>
* refactor(sponsor-panel): update oauth handlers to use GORM
Replace s.pool with s.db, update function signatures, rename User
to PanelUser, and cast user.ID to int for session compatibility.
Assisted-by: Claude Opus 4.6 via Claude Code
Signed-off-by: Xe Iaso <me@xeiaso.net>
* refactor(sponsor-panel): update patreon oauth to use GORM
Replace s.pool with s.db, rename User to PanelUser, cast user.ID
to int for session storage.
Assisted-by: Claude Opus 4.6 via Claude Code
Signed-off-by: Xe Iaso <me@xeiaso.net>
* refactor(sponsor-panel): update handlers to use GORM
Replace s.pool with s.db for createLogoSubmission call.
Assisted-by: Claude Opus 4.6 via Claude Code
Signed-off-by: Xe Iaso <me@xeiaso.net>
* refactor(sponsor-panel): update sync sponsors to use GORM
Replace pgxpool.Pool with gorm.DB in syncSponsors and startSyncLoop.
Assisted-by: Claude Opus 4.6 via Claude Code
Signed-off-by: Xe Iaso <me@xeiaso.net>
* feat(sponsor-panel): add index drop tool for GORM migration
One-shot tool to drop old hand-created indexes and constraints
so GORM AutoMigrate can recreate them with its own naming scheme.
Assisted-by: Claude Opus 4.6 via Claude Code
Signed-off-by: Xe Iaso <me@xeiaso.net>
* build(deps): add slog-gorm and gorm-prometheus dependencies
Assisted-by: Claude Opus 4.6 via Claude Code
Signed-off-by: Xe Iaso <me@xeiaso.net>
* chore: update templ generated code to v0.3.1001
Signed-off-by: Xe Iaso <me@xeiaso.net>
* docs(sponsor-panel): add GORM migration implementation plan
Assisted-by: Claude Opus 4.6 via Claude Code
Signed-off-by: Xe Iaso <me@xeiaso.net>
---------
Signed-off-by: Xe Iaso <me@xeiaso.net>1 parent 504058e commit 9230411
13 files changed
Lines changed: 1518 additions & 392 deletions
File tree
- cmd
- sponsor-panel-drop-indexes
- sponsor-panel
- docs/superpowers/plans
- web/htmx
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
284 | | - | |
| 284 | + | |
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
63 | | - | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
144 | 147 | | |
145 | 148 | | |
146 | 149 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
151 | 158 | | |
152 | | - | |
| 159 | + | |
153 | 160 | | |
154 | 161 | | |
155 | | - | |
156 | 162 | | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
161 | 167 | | |
162 | 168 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
167 | 173 | | |
168 | 174 | | |
169 | | - | |
| 175 | + | |
170 | 176 | | |
171 | 177 | | |
172 | 178 | | |
173 | 179 | | |
174 | | - | |
| 180 | + | |
175 | 181 | | |
176 | 182 | | |
177 | 183 | | |
| |||
255 | 261 | | |
256 | 262 | | |
257 | 263 | | |
258 | | - | |
| 264 | + | |
259 | 265 | | |
260 | 266 | | |
261 | 267 | | |
| |||
This file was deleted.
0 commit comments