Scert/backend/internal/database/migrations/mysql/0027_dns_accounts.sql
xuans 02e039984a 保存 DNS 多账户数据层与实库故障夹具修复前检查点
基础模型和迁移已完成;增量竞态暴露 MySQL 审计故障注入权限问题,后续修复,不代表完整功能或验收通过。
2026-10-04 04:42:39 +08:00

17 lines
735 B
SQL

CREATE TABLE dns_accounts (
id VARCHAR(36) NOT NULL PRIMARY KEY,
name VARCHAR(128) NOT NULL,
project_id VARCHAR(36) NOT NULL,
owner_user_id VARCHAR(36) NOT NULL,
provider VARCHAR(36) NOT NULL,
credential_ref VARCHAR(255) NOT NULL,
status VARCHAR(16) NOT NULL,
verification_state VARCHAR(16) NOT NULL,
revision INT NOT NULL,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
UNIQUE KEY uq_dns_accounts_credential (credential_ref),
INDEX idx_dns_accounts_project (project_id, id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
ALTER TABLE dns_accounts ADD CONSTRAINT fk_dns_accounts_project FOREIGN KEY (project_id) REFERENCES projects (id) ON DELETE RESTRICT;