]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
docs: improve documentation of MySQL foreign keys 5006/head
authorPeter Thomassen <peter@desec.io>
Mon, 20 Feb 2017 10:26:05 +0000 (11:26 +0100)
committerPeter Thomassen <peter@desec.io>
Mon, 20 Feb 2017 10:26:05 +0000 (11:26 +0100)
So far, the docs mentioned the foreign key for the records table only.
However, if foreign keys are used, they also make sense for the
domainmetadata, cryptokeys, and comments tables.

Corresponding SQL is already in an .sql file in the repository. This
commit replaces the incomplete information with these statements.

docs/markdown/authoritative/backend-generic-mysql.md

index 40ef860baf26d342b635bac7b25ba888d14785e8..6cb122194e2cf5dda3e0b0aa923c5d81647cc465 100644 (file)
@@ -24,23 +24,14 @@ with the `--gmysql` flag also assumes this layout is in place. For full migratio
 notes, please see [Migration](migration.md). This schema contains all elements
 needed for master, slave and superslave operation.
 
-When using the InnoDB storage engine, we suggest adding the following lines to
-the 'create table records' command above:
-
-```
-CONSTRAINT `records_ibfk_1` FOREIGN KEY (`domain_id`) REFERENCES `domains`
-(`id`) ON DELETE CASCADE
-```
-
-Or, if you have already created the tables, execute:
-
+When using the InnoDB storage engine, we suggest adding foreign key contraints 
+to the tables in order to automate deletion of records, key material, and other 
+information upon deletion of a domain from the domains table. The following SQL 
+does the job:
 ```
-ALTER TABLE `records` ADD CONSTRAINT `records_ibfk_1` FOREIGN KEY (`domain_id`)
-REFERENCES `domains` (`id`) ON DELETE CASCADE;
+!!include=../modules/gmysqlbackend/enable-foreign-keys.mysql.sql
 ```
 
-This automates deletion of records on deletion of a domain from the domains table.
-
 # Using MySQL replication
 To support `NATIVE` domains, the `binlog_format` for the MySQL replication **must**
 be set to `MIXED` or `ROW` to prevent differences in data between replicated