diff options
Diffstat (limited to 'migrations')
| -rw-r--r-- | migrations/035_oauth_token_errors.sql | 14 | ||||
| -rw-r--r-- | migrations/README.md | 3 |
2 files changed, 16 insertions, 1 deletions
diff --git a/migrations/035_oauth_token_errors.sql b/migrations/035_oauth_token_errors.sql new file mode 100644 index 0000000..c0100c0 --- /dev/null +++ b/migrations/035_oauth_token_errors.sql @@ -0,0 +1,14 @@ +-- Record why an OAuth token stopped working. +-- +-- A stored token row was treated as "connected", full stop. When the refresh +-- token itself goes bad — Google answers invalid_grant, which happens when it +-- is revoked, superseded, or (for an OAuth client still in Testing publishing +-- status) simply older than seven days — settings still showed Google Tasks as +-- connected while every fetch failed in the background. +-- +-- Persisting the failure lets settings say "reconnect" instead of "connected", +-- which is the difference between a five-second fix and not knowing anything +-- is wrong. Cleared on the next successful refresh. + +ALTER TABLE oauth_tokens ADD COLUMN last_error TEXT; +ALTER TABLE oauth_tokens ADD COLUMN last_error_at DATETIME; diff --git a/migrations/README.md b/migrations/README.md index 07320af..0382065 100644 --- a/migrations/README.md +++ b/migrations/README.md @@ -30,10 +30,11 @@ Migrations are applied automatically on application startup via `store.RunMigrat | 032 | `032_import_trello_shopping_items.sql` | One-time import of Trello Shopping-board cards (Hardware Store + unlisted) into user items, ahead of removing Trello as a shopping source | | 033 | `033_ics_feeds.sql` | Subscribed iCalendar (.ics) feeds, merged into calendar_events | | 034 | `034_shopping_stores_and_sections.sql` | Store/section registry + `user_shopping_items.section` | +| 035 | `035_oauth_token_errors.sql` | Persist why an OAuth refresh failed, so settings can say "reconnect" | ## Creating New Migrations -1. Create file: `migrations/NNN_description.sql` (next number is 035) +1. Create file: `migrations/NNN_description.sql` (next number is 036) 2. Write idempotent SQL (use `IF NOT EXISTS` where possible) 3. Test locally: `go run cmd/dashboard/main.go` 4. Verify: Check `schema_migrations` table for new entry |
