From ed9e34cb7ad32a43d6c36d26f65da2a0805e69a2 Mon Sep 17 00:00:00 2001 From: Peter Thomassen Date: Mon, 20 Feb 2017 11:26:05 +0100 Subject: [PATCH] docs: improve documentation of MySQL foreign keys 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. --- .../authoritative/backend-generic-mysql.md | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/docs/markdown/authoritative/backend-generic-mysql.md b/docs/markdown/authoritative/backend-generic-mysql.md index 40ef860baf..6cb122194e 100644 --- a/docs/markdown/authoritative/backend-generic-mysql.md +++ b/docs/markdown/authoritative/backend-generic-mysql.md @@ -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 -- 2.47.2