Initialer Schema-Set (8 Migrationen, 13 Tabellen) für EdgeGuard v1: users + audit_log + system_settings, ha_nodes, backends/domains/ routing_rules/tls_certs, forward_proxy_acls, wireguard_peers, firewall_rules, dns_zones/dns_records, licenses. Migrations liegen in internal/database/migrations/ (analog mail-gateway) und werden per //go:embed ins Binary gepackt — keine separate SQL-Dateien im .deb. ValidateMigrations + Test schützen vor Duplicate-Versionen (mail-gateway 2026-05-08-Vorfall). GORM-Models für alle Tabellen, sensible Felder (password_hash, private_key_enc) sind json:"-". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
31 lines
1.4 KiB
Go
31 lines
1.4 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
type DNSZone struct {
|
|
ID int64 `gorm:"primaryKey" json:"id"`
|
|
Name string `gorm:"column:name;uniqueIndex" json:"name"`
|
|
ZoneType string `gorm:"column:zone_type" json:"zone_type"`
|
|
Description *string `gorm:"column:description" json:"description,omitempty"`
|
|
ManagedBy string `gorm:"column:managed_by" json:"managed_by"`
|
|
Active bool `gorm:"column:active" json:"active"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"`
|
|
}
|
|
|
|
func (DNSZone) TableName() string { return "dns_zones" }
|
|
|
|
type DNSRecord struct {
|
|
ID int64 `gorm:"primaryKey" json:"id"`
|
|
ZoneID int64 `gorm:"column:zone_id" json:"zone_id"`
|
|
Name string `gorm:"column:name" json:"name"`
|
|
RecordType string `gorm:"column:record_type" json:"record_type"`
|
|
Value string `gorm:"column:value" json:"value"`
|
|
TTL int `gorm:"column:ttl" json:"ttl"`
|
|
Active bool `gorm:"column:active" json:"active"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"`
|
|
}
|
|
|
|
func (DNSRecord) TableName() string { return "dns_records" }
|