xref: /webtrees/app/Schema/Migration6.php (revision bd52fa32338513b5d44dc6b1b89178c1bbf60b6a)
13bfb94b0SGreg Roach<?php
23bfb94b0SGreg Roach/**
33bfb94b0SGreg Roach * webtrees: online genealogy
46bdf7674SGreg Roach * Copyright (C) 2017 webtrees development team
53bfb94b0SGreg Roach * This program is free software: you can redistribute it and/or modify
63bfb94b0SGreg Roach * it under the terms of the GNU General Public License as published by
73bfb94b0SGreg Roach * the Free Software Foundation, either version 3 of the License, or
83bfb94b0SGreg Roach * (at your option) any later version.
93bfb94b0SGreg Roach * This program is distributed in the hope that it will be useful,
103bfb94b0SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
113bfb94b0SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
123bfb94b0SGreg Roach * GNU General Public License for more details.
133bfb94b0SGreg Roach * You should have received a copy of the GNU General Public License
143bfb94b0SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
153bfb94b0SGreg Roach */
1676692c8bSGreg Roachnamespace Fisharebest\Webtrees\Schema;
1776692c8bSGreg Roach
183bfb94b0SGreg Roachuse Fisharebest\Webtrees\Database;
19*bd52fa32SGreg Roachuse Fisharebest\Webtrees\DebugBar;
203bfb94b0SGreg Roachuse PDOException;
213bfb94b0SGreg Roach
223bfb94b0SGreg Roach/**
2376692c8bSGreg Roach * Upgrade the database schema from version 6 to version 7.
243bfb94b0SGreg Roach */
253bfb94b0SGreg Roachclass Migration6 implements MigrationInterface {
2676692c8bSGreg Roach	/**
2776692c8bSGreg Roach	 * Upgrade to to the next version
2876692c8bSGreg Roach	 */
293bfb94b0SGreg Roach	public function upgrade() {
303bfb94b0SGreg Roach		// Remove tables/columns relating to remote linking
313bfb94b0SGreg Roach
323bfb94b0SGreg Roach		try {
333bfb94b0SGreg Roach			Database::exec(
343bfb94b0SGreg Roach				"DROP TABLE `##remotelinks`"
353bfb94b0SGreg Roach			);
363bfb94b0SGreg Roach		} catch (PDOException $ex) {
37*bd52fa32SGreg Roach			DebugBar::addThrowable($ex);
38*bd52fa32SGreg Roach
393bfb94b0SGreg Roach			// already been done?
403bfb94b0SGreg Roach		}
413bfb94b0SGreg Roach
423bfb94b0SGreg Roach		try {
433bfb94b0SGreg Roach			Database::exec(
443bfb94b0SGreg Roach				"ALTER TABLE `##sources` DROP INDEX ix2"
453bfb94b0SGreg Roach			);
463bfb94b0SGreg Roach		} catch (PDOException $ex) {
47*bd52fa32SGreg Roach			DebugBar::addThrowable($ex);
48*bd52fa32SGreg Roach
493bfb94b0SGreg Roach			// already been done?
503bfb94b0SGreg Roach		}
513bfb94b0SGreg Roach
523bfb94b0SGreg Roach		try {
533bfb94b0SGreg Roach			Database::exec(
543bfb94b0SGreg Roach				"ALTER TABLE `##sources` DROP COLUMN s_dbid"
553bfb94b0SGreg Roach			);
563bfb94b0SGreg Roach		} catch (PDOException $ex) {
57*bd52fa32SGreg Roach			DebugBar::addThrowable($ex);
58*bd52fa32SGreg Roach
593bfb94b0SGreg Roach			// already been done?
603bfb94b0SGreg Roach		}
613bfb94b0SGreg Roach	}
623bfb94b0SGreg Roach}
63