diff options
author | Thomas Lange <code@nerdmind.de> | 2017-10-13 19:20:42 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2017-10-13 19:20:42 +0200 |
commit | a1a63eb2f812d621d3b3d7db2c00346bb94c0709 (patch) | |
tree | 7257e5c2e474aa3b1e96ceb4f6e3f9e096f1722c /403.php | |
parent | 497d03e057360485782bccc4317069a405023aec (diff) | |
download | blog-a1a63eb2f812d621d3b3d7db2c00346bb94c0709.tar.gz blog-a1a63eb2f812d621d3b3d7db2c00346bb94c0709.tar.xz blog-a1a63eb2f812d621d3b3d7db2c00346bb94c0709.zip |
WARNING: This commit updates the table engine for the "post" table from MyISAM to InnoDB and results in version 2.4. The only reason why the post table originally used MyISAM instead of InnoDB as engine was because the post table had a FULLTEXT index, which was only possible with MyISAM tables on MySQL versions smaller than 5.6 and MariaDB versions smaller than 10.0.5. However, MyISAM tables do not know foreign keys, so no relationship between the post and the user table could be established (which is bad for data integrity). In newer versions of MySQL or MariaDB are FULLTEXT indexes also possible on InnoDB tables. So, we can now update the post table to InnoDB to keep the FULLTEXT search functionality and we can add a foreign key for data integrity.v2.4
This means for you: If you are already using a recent version of MySQL or MariaDB, you can safely make the update (always make a backup first). If you are not using at least MariaDB 10.0.5 or MySQL 5.6, you will have to wait with this (and all further) commits / updates until you have upgraded your database server to a more recent version.
Database update to version 2.4 (no existing data will be lost or changed):
ALTER TABLE `post` ENGINE=InnoDB;
ALTER TABLE `post` DROP INDEX `body`;
ALTER TABLE `page` ADD FULLTEXT KEY `search` (`name`, `body`);
ALTER TABLE `post` ADD FULLTEXT KEY `search` (`name`, `body`);
ALTER TABLE `post` ADD CONSTRAINT `post_user` FOREIGN KEY (`user`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
Diffstat (limited to '403.php')
0 files changed, 0 insertions, 0 deletions