Files
sub-store/internal/database/migrations/0004_source_alias_collection_rename.sql
T
rogee de9ac92ede feat: GeoIP-based geo detection + configurable rename template
- Add MaxMind GeoLite2-City mmdb auto-download and IP-based geo lookup
  (covers all 249 countries globally, replacing limited 8-country regex)
- Add RenameOptions with 5 toggleable fields (flag/alias/country/city/index)
  stored as rename_options_json on collections
- Collection rename pipeline uses DetectGeoWithServer(name, server) which
  tries GeoIP lookup first, falls back to name-based regex matching
- Chinese country/city names + emoji flag prefix
- Country-city dedup: skip city when it equals country (e.g. 香港/香港)
- URI fragment encoding: url.QueryEscape -> url.PathEscape (%20 not +)
- Egress cache key excludes name field so renamed nodes still match cache
- Frontend: 5 toggle buttons in collection edit form, default all on
- Migrations: 0004 (source alias + collection rename_enabled),
  0005 (collection rename_options_json)
2026-07-28 14:44:54 +08:00

10 lines
401 B
SQL

-- +goose Up
ALTER TABLE sources ADD COLUMN alias TEXT NOT NULL DEFAULT '';
-- Collections no longer have filters; they have a rename toggle instead.
ALTER TABLE collections ADD COLUMN rename_enabled INTEGER NOT NULL DEFAULT 0;
-- +goose Down
-- SQLite does not support DROP COLUMN before 3.35; these columns are harmless
-- if left in place. For a clean rollback, recreate the tables without them.