13bfb94b0SGreg Roach<?php 23bfb94b0SGreg Roach/** 33bfb94b0SGreg Roach * webtrees: online genealogy 41062a142SGreg Roach * Copyright (C) 2018 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 */ 16e7f56f2aSGreg Roachdeclare(strict_types=1); 17e7f56f2aSGreg Roach 1876692c8bSGreg Roachnamespace Fisharebest\Webtrees\Schema; 1976692c8bSGreg Roach 203bfb94b0SGreg Roachuse Fisharebest\Webtrees\Database; 213bfb94b0SGreg Roach 223bfb94b0SGreg Roach/** 2376692c8bSGreg Roach * Upgrade the database schema from version 1 to version 2. 243bfb94b0SGreg Roach */ 25c1010edaSGreg Roachclass Migration1 implements MigrationInterface 26c1010edaSGreg Roach{ 2776692c8bSGreg Roach /** 28*362be83aSGreg Roach * Upgrade to to the next version. 2919d91378SGreg Roach * 3019d91378SGreg Roach * @return void 3176692c8bSGreg Roach */ 32*362be83aSGreg Roach public function upgrade(): void 33c1010edaSGreg Roach { 343bfb94b0SGreg Roach // Create the wt_session table to store session data in the database, 353bfb94b0SGreg Roach // rather than in the filesystem. 363bfb94b0SGreg Roach Database::exec( 373bfb94b0SGreg Roach "CREATE TABLE IF NOT EXISTS `##session` (" . 383bfb94b0SGreg Roach " session_id CHAR(32) NOT NULL," . 393bfb94b0SGreg Roach " session_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," . 403bfb94b0SGreg Roach " user_id INTEGER NOT NULL," . 413bfb94b0SGreg Roach " ip_address VARCHAR(32) NOT NULL," . 423bfb94b0SGreg Roach " session_data MEDIUMBLOB NOT NULL," . 433bfb94b0SGreg Roach " PRIMARY KEY (session_id)," . 443bfb94b0SGreg Roach " KEY ix1 (session_time)," . 453bfb94b0SGreg Roach " KEY ix2 (user_id, ip_address)" . 463bfb94b0SGreg Roach ") COLLATE utf8_unicode_ci ENGINE=InnoDB" 473bfb94b0SGreg Roach ); 483bfb94b0SGreg Roach } 493bfb94b0SGreg Roach} 50