make name type content unique in dns records
This commit is contained in:
parent
38110bb19d
commit
1fd1444f97
|
@ -59,10 +59,17 @@ func MigrateDNSRecords(dbConn *sql.DB) (*sql.DB, error) {
|
|||
ttl INTEGER NOT NULL,
|
||||
internal BOOLEAN NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE);`)
|
||||
FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE
|
||||
);`)
|
||||
if err != nil {
|
||||
return dbConn, err
|
||||
}
|
||||
|
||||
_, err = dbConn.Exec(`CREATE UNIQUE INDEX IF NOT EXISTS idx_dns_records_name_content_type ON dns_records (name, type, content);`)
|
||||
if err != nil {
|
||||
return dbConn, err
|
||||
}
|
||||
|
||||
return dbConn, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue