xref: /webtrees/app/Schema/Migration35.php (revision 19d913785a45657df3e7bc9cd4411f501dd5071b)
115e87d46SGreg Roach<?php
215e87d46SGreg Roach/**
315e87d46SGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
515e87d46SGreg Roach * This program is free software: you can redistribute it and/or modify
615e87d46SGreg Roach * it under the terms of the GNU General Public License as published by
715e87d46SGreg Roach * the Free Software Foundation, either version 3 of the License, or
815e87d46SGreg Roach * (at your option) any later version.
915e87d46SGreg Roach * This program is distributed in the hope that it will be useful,
1015e87d46SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
1115e87d46SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1215e87d46SGreg Roach * GNU General Public License for more details.
1315e87d46SGreg Roach * You should have received a copy of the GNU General Public License
1415e87d46SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515e87d46SGreg Roach */
1615e87d46SGreg Roachnamespace Fisharebest\Webtrees\Schema;
1715e87d46SGreg Roach
1815e87d46SGreg Roachuse Fisharebest\Webtrees\Database;
1915e87d46SGreg Roach
2015e87d46SGreg Roach/**
2115e87d46SGreg Roach * Upgrade the database schema from version 35 to version 36.
2215e87d46SGreg Roach */
23c1010edaSGreg Roachclass Migration35 implements MigrationInterface
24c1010edaSGreg Roach{
2515e87d46SGreg Roach    /**
2615e87d46SGreg Roach     * Upgrade to to the next version
27*19d91378SGreg Roach     *
28*19d91378SGreg Roach     * @return void
2915e87d46SGreg Roach     */
30c1010edaSGreg Roach    public function upgrade()
31c1010edaSGreg Roach    {
3215e87d46SGreg Roach        // Use LONGTEXT instead of TEXT and MEDIUMTEXT, and make NOT NULL.
3315e87d46SGreg Roach        Database::exec("UPDATE `##news`   SET body          = '' WHERE body          IS NULL");
3415e87d46SGreg Roach        Database::exec("UPDATE `##other`  SET o_gedcom      = '' WHERE o_gedcom      IS NULL");
3515e87d46SGreg Roach        Database::exec("UPDATE `##places` SET p_std_soundex = '' WHERE p_std_soundex IS NULL");
3615e87d46SGreg Roach        Database::exec("UPDATE `##places` SET p_dm_soundex  = '' WHERE p_dm_soundex  IS NULL");
3715e87d46SGreg Roach        Database::exec("ALTER TABLE `##block_setting`  CHANGE setting_value setting_value LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
3815e87d46SGreg Roach        Database::exec("ALTER TABLE `##change`         CHANGE new_gedcom    new_gedcom    LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
3915e87d46SGreg Roach        Database::exec("ALTER TABLE `##change`         CHANGE old_gedcom    old_gedcom    LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
4015e87d46SGreg Roach        Database::exec("ALTER TABLE `##families`       CHANGE f_gedcom      f_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
4115e87d46SGreg Roach        Database::exec("ALTER TABLE `##individuals`    CHANGE i_gedcom      i_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
4215e87d46SGreg Roach        Database::exec("ALTER TABLE `##log`            CHANGE log_message   log_message   LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
4315e87d46SGreg Roach        Database::exec("ALTER TABLE `##media`          CHANGE m_gedcom      m_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
4415e87d46SGreg Roach        Database::exec("ALTER TABLE `##message`        CHANGE body          body          LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
4515e87d46SGreg Roach        Database::exec("ALTER TABLE `##module_setting` CHANGE setting_value setting_value LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
4615e87d46SGreg Roach        Database::exec("ALTER TABLE `##news`           CHANGE body          body          LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
4715e87d46SGreg Roach        Database::exec("ALTER TABLE `##other`          CHANGE o_gedcom      o_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
4815e87d46SGreg Roach        Database::exec("ALTER TABLE `##places`         CHANGE p_std_soundex p_std_soundex LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
4915e87d46SGreg Roach        Database::exec("ALTER TABLE `##places`         CHANGE p_dm_soundex  p_dm_soundex  LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
5015e87d46SGreg Roach        Database::exec("ALTER TABLE `##sources`        CHANGE s_gedcom      s_gedcom      LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
5115e87d46SGreg Roach        // Use LONGBLOB instead of MEDIUMBLOB.
5215e87d46SGreg Roach        Database::exec("ALTER TABLE `##gedcom_chunk`   CHANGE chunk_data    chunk_data    LONGBLOB NOT NULL");
5315e87d46SGreg Roach        Database::exec("ALTER TABLE `##session`        CHANGE session_data  session_data  LONGBLOB NOT NULL");
5415e87d46SGreg Roach    }
5515e87d46SGreg Roach}
56