xref: /webtrees/app/Schema/Migration35.php (revision 76a5e7c78a07f5736a3cd5b7437c8f18dc196a5e)
1<?php
2/**
3 * webtrees: online genealogy
4 * Copyright (C) 2017 webtrees development team
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16namespace Fisharebest\Webtrees\Schema;
17
18use Fisharebest\Webtrees\Database;
19
20/**
21 * Upgrade the database schema from version 35 to version 36.
22 */
23class Migration35 implements MigrationInterface {
24	/**
25	 * Upgrade to to the next version
26	 */
27	public function upgrade() {
28		// Use LONGTEXT instead of TEXT and MEDIUMTEXT, and make NOT NULL.
29		Database::exec("UPDATE `##news`   SET body          = '' WHERE body          IS NULL");
30		Database::exec("UPDATE `##other`  SET o_gedcom      = '' WHERE o_gedcom      IS NULL");
31		Database::exec("UPDATE `##places` SET p_std_soundex = '' WHERE p_std_soundex IS NULL");
32		Database::exec("UPDATE `##places` SET p_dm_soundex  = '' WHERE p_dm_soundex  IS NULL");
33		Database::exec("ALTER TABLE `##block_setting`  CHANGE setting_value setting_value LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
34		Database::exec("ALTER TABLE `##change`         CHANGE new_gedcom    new_gedcom    LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
35		Database::exec("ALTER TABLE `##change`         CHANGE old_gedcom    old_gedcom    LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
36		Database::exec("ALTER TABLE `##families`       CHANGE f_gedcom      f_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
37		Database::exec("ALTER TABLE `##individuals`    CHANGE i_gedcom      i_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
38		Database::exec("ALTER TABLE `##log`            CHANGE log_message   log_message   LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
39		Database::exec("ALTER TABLE `##media`          CHANGE m_gedcom      m_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
40		Database::exec("ALTER TABLE `##message`        CHANGE body          body          LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
41		Database::exec("ALTER TABLE `##module_setting` CHANGE setting_value setting_value LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
42		Database::exec("ALTER TABLE `##news`           CHANGE body          body          LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
43		Database::exec("ALTER TABLE `##other`          CHANGE o_gedcom      o_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
44		Database::exec("ALTER TABLE `##places`         CHANGE p_std_soundex p_std_soundex LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
45		Database::exec("ALTER TABLE `##places`         CHANGE p_dm_soundex  p_dm_soundex  LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
46		Database::exec("ALTER TABLE `##sources`        CHANGE s_gedcom      s_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
47		// Use LONGBLOB instead of MEDIUMBLOB.
48		Database::exec("ALTER TABLE `##gedcom_chunk`   CHANGE chunk_data    chunk_data    LONGBLOB NOT NULL");
49		Database::exec("ALTER TABLE `##session`        CHANGE session_data  session_data  LONGBLOB NOT NULL");
50	}
51}
52