Allow domains to belong to multiple third parties

Change the unique constraint on common_third_party_domains from (domain)
to (common_third_party_id, domain) so a domain like google.com can be
associated with Google, Google Analytics, Google AdSense, etc.

Also fix Beamer domain (was hotjar.com, now getbeamer.com) and preserve
the original url.Parse error in pgconn DSN parsing.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-05-15 11:02:31 +04:00
parent 1a9cef7a9d
commit ed41b354b0
5 changed files with 8 additions and 7 deletions

View File

@@ -1 +1,3 @@
# Changelog
All notable changes to the `proboctl` CLI will be documented in this file.

View File

@@ -136,10 +136,9 @@ INSERT INTO common_third_party_domains (
@created_at,
@updated_at
)
ON CONFLICT (domain) DO UPDATE
ON CONFLICT (common_third_party_id, domain) DO UPDATE
SET
common_third_party_id = EXCLUDED.common_third_party_id,
updated_at = EXCLUDED.updated_at
updated_at = EXCLUDED.updated_at
RETURNING (xmax = 0) AS inserted
`

View File

@@ -23,8 +23,8 @@ CREATE TABLE common_third_party_domains (
updated_at TIMESTAMP WITH TIME ZONE NOT NULL
);
CREATE UNIQUE INDEX common_third_party_domains_domain_key
ON common_third_party_domains (domain);
CREATE UNIQUE INDEX common_third_party_domains_party_domain_key
ON common_third_party_domains (common_third_party_id, domain);
CREATE INDEX idx_common_third_party_domains_third_party
ON common_third_party_domains (common_third_party_id);

View File

@@ -25,7 +25,7 @@ import (
func NewPgClientFromDSN(dsn string) (*pg.Client, error) {
u, err := url.Parse(dsn)
if err != nil {
return nil, fmt.Errorf("cannot parse DSN (check URL format)")
return nil, fmt.Errorf("cannot parse DSN: %w", err)
}
var opts []pg.Option

View File

@@ -761,7 +761,7 @@
"name": "Beamer",
"category": "MARKETING",
"domains": [
"hotjar.com"
"getbeamer.com"
],
"websiteUrl": "https://www.getbeamer.com",
"legalName": "Beamer, Inc.",