-- Domain-Aufstellung: je Domain Einkauf (netto), Verkauf (netto/brutto) und Beschaffungsstatus (Bestellung beim Registrar KCS) CREATE TABLE domain_records ( id CHAR(36) PRIMARY KEY, domain VARCHAR(253) NOT NULL, tld VARCHAR(63) NOT NULL, org_id CHAR(36) NULL, resource_id CHAR(36) NULL, source ENUM('keyhelp','manual') NOT NULL DEFAULT 'manual', term_months INT NULL, cost_net_cents INT NULL, -- Einkauf netto (Preisstaffel zum Zeitpunkt der Erfassung) setup_cost_cents INT NOT NULL DEFAULT 0, sell_net_cents INT NULL, -- errechneter Verkaufspreis netto tax_bp INT NOT NULL DEFAULT 1900, sell_gross_cents INT NULL, -- errechneter Verkaufspreis brutto procurement ENUM('open','ordered','external') NOT NULL DEFAULT 'open', -- open = bei KCS zu bestellen, external = liegt bei anderem Anbieter ordered_at DATETIME(3) NULL, ordered_ref VARCHAR(100) NULL, note VARCHAR(300) NULL, priced_at DATETIME(3) NULL, created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), UNIQUE KEY uq_domain (domain), KEY idx_dr_org (org_id), KEY idx_dr_res (resource_id), KEY idx_dr_proc (procurement) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;