Migrate to normalized FK schema (domain_host, domain_tld)
Replace source_host column with proper FK to domains table using composite key (domain_host, domain_tld). This enables JOIN queries instead of string concatenation for domain lookups. Changes: - Update Feed struct: SourceHost/TLD → DomainHost/DomainTLD - Update all SQL queries to use domain_host/domain_tld columns - Add column aliases (as source_host) for API backwards compatibility - Update trigram index from source_host to domain_host - Add getDomainHost() helper for extracting host from domain Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -61,6 +61,12 @@ func stripTLD(host string) string {
|
||||
return host
|
||||
}
|
||||
|
||||
// getDomainHost extracts the host part from a full domain (without TLD)
|
||||
// e.g., "npr.org" -> "npr", "bbc.co.uk" -> "bbc.co"
|
||||
func getDomainHost(domain string) string {
|
||||
return stripTLD(domain)
|
||||
}
|
||||
|
||||
// fullHost reconstructs the full hostname from host and tld
|
||||
// e.g., ("example", "com") -> "example.com"
|
||||
func fullHost(host, tld string) string {
|
||||
|
||||
Reference in New Issue
Block a user