DNS server (add NS record)
This commit is contained in:
7
dns/migrations/002_remove_ip_requirement.sql
Normal file
7
dns/migrations/002_remove_ip_requirement.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
-- Make IP column optional for domains
|
||||
ALTER TABLE domains ALTER COLUMN ip DROP NOT NULL;
|
||||
|
||||
-- Update DNS records constraint to only allow A, AAAA, CNAME, TXT
|
||||
ALTER TABLE dns_records DROP CONSTRAINT IF EXISTS dns_records_record_type_check;
|
||||
ALTER TABLE dns_records ADD CONSTRAINT dns_records_record_type_check
|
||||
CHECK (record_type IN ('A', 'AAAA', 'CNAME', 'TXT'));
|
||||
10
dns/migrations/003_add_ns_records.sql
Normal file
10
dns/migrations/003_add_ns_records.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
-- Re-add NS record support and extend record types
|
||||
ALTER TABLE dns_records DROP CONSTRAINT IF EXISTS dns_records_record_type_check;
|
||||
ALTER TABLE dns_records ADD CONSTRAINT dns_records_record_type_check
|
||||
CHECK (record_type IN ('A', 'AAAA', 'CNAME', 'TXT', 'NS', 'MX'));
|
||||
|
||||
-- Add index for efficient NS record lookups during delegation
|
||||
CREATE INDEX IF NOT EXISTS idx_dns_records_ns_lookup ON dns_records(record_type, name) WHERE record_type = 'NS';
|
||||
|
||||
-- Add index for subdomain resolution optimization
|
||||
CREATE INDEX IF NOT EXISTS idx_dns_records_subdomain_lookup ON dns_records(domain_id, name, record_type);
|
||||
8
dns/migrations/004_fix_record_types.sql
Normal file
8
dns/migrations/004_fix_record_types.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Fix record types to remove MX and ensure NS is supported
|
||||
ALTER TABLE dns_records DROP CONSTRAINT IF EXISTS dns_records_record_type_check;
|
||||
ALTER TABLE dns_records ADD CONSTRAINT dns_records_record_type_check
|
||||
CHECK (record_type IN ('A', 'AAAA', 'CNAME', 'TXT', 'NS'));
|
||||
|
||||
-- Add indexes for efficient DNS lookups if they don't exist
|
||||
CREATE INDEX IF NOT EXISTS idx_dns_records_ns_lookup ON dns_records(record_type, name) WHERE record_type = 'NS';
|
||||
CREATE INDEX IF NOT EXISTS idx_dns_records_subdomain_lookup ON dns_records(domain_id, name, record_type);
|
||||
Reference in New Issue
Block a user