summaryrefslogtreecommitdiff
path: root/app/Schema
diff options
context:
space:
mode:
Diffstat (limited to 'app/Schema')
-rw-r--r--app/Schema/Migration0.php708
-rw-r--r--app/Schema/Migration1.php42
-rw-r--r--app/Schema/Migration10.php22
-rw-r--r--app/Schema/Migration11.php40
-rw-r--r--app/Schema/Migration12.php36
-rw-r--r--app/Schema/Migration13.php28
-rw-r--r--app/Schema/Migration14.php24
-rw-r--r--app/Schema/Migration15.php36
-rw-r--r--app/Schema/Migration16.php34
-rw-r--r--app/Schema/Migration17.php18
-rw-r--r--app/Schema/Migration18.php46
-rw-r--r--app/Schema/Migration19.php20
-rw-r--r--app/Schema/Migration2.php56
-rw-r--r--app/Schema/Migration20.php62
-rw-r--r--app/Schema/Migration21.php86
-rw-r--r--app/Schema/Migration22.php143
-rw-r--r--app/Schema/Migration23.php34
-rw-r--r--app/Schema/Migration24.php42
-rw-r--r--app/Schema/Migration25.php26
-rw-r--r--app/Schema/Migration26.php108
-rw-r--r--app/Schema/Migration27.php26
-rw-r--r--app/Schema/Migration28.php22
-rw-r--r--app/Schema/Migration29.php82
-rw-r--r--app/Schema/Migration3.php72
-rw-r--r--app/Schema/Migration30.php248
-rw-r--r--app/Schema/Migration31.php104
-rw-r--r--app/Schema/Migration32.php36
-rw-r--r--app/Schema/Migration33.php18
-rw-r--r--app/Schema/Migration34.php26
-rw-r--r--app/Schema/Migration35.php58
-rw-r--r--app/Schema/Migration36.php22
-rw-r--r--app/Schema/Migration37.php114
-rw-r--r--app/Schema/Migration38.php144
-rw-r--r--app/Schema/Migration39.php188
-rw-r--r--app/Schema/Migration4.php50
-rw-r--r--app/Schema/Migration5.php56
-rw-r--r--app/Schema/Migration6.php54
-rw-r--r--app/Schema/Migration7.php34
-rw-r--r--app/Schema/Migration8.php32
-rw-r--r--app/Schema/Migration9.php50
-rw-r--r--app/Schema/MigrationInterface.php11
41 files changed, 1571 insertions, 1487 deletions
diff --git a/app/Schema/Migration0.php b/app/Schema/Migration0.php
index 6901656c6a..58e4c72745 100644
--- a/app/Schema/Migration0.php
+++ b/app/Schema/Migration0.php
@@ -22,359 +22,361 @@ use Fisharebest\Webtrees\Site;
/**
* Upgrade the database schema from version 0 (empty database) to version 1.
*/
-class Migration0 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##gedcom` (" .
- " gedcom_id INTEGER AUTO_INCREMENT NOT NULL," .
- " gedcom_name VARCHAR(255) NOT NULL," .
- " sort_order INTEGER NOT NULL DEFAULT 0," .
- " PRIMARY KEY (gedcom_id)," .
- " UNIQUE KEY `##gedcom_ix1` (gedcom_name)," .
- " KEY `##gedcom_ix2` (sort_order)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##site_setting` (" .
- " setting_name VARCHAR(32) NOT NULL," .
- " setting_value VARCHAR(255) NOT NULL," .
- " PRIMARY KEY (setting_name)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##gedcom_setting` (" .
- " gedcom_id INTEGER NOT NULL," .
- " setting_name VARCHAR(32) NOT NULL," .
- " setting_value VARCHAR(255) NOT NULL," .
- " PRIMARY KEY (gedcom_id, setting_name)," .
- " FOREIGN KEY `##gedcom_setting_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##user` (" .
- " user_id INTEGER AUTO_INCREMENT NOT NULL," .
- " user_name VARCHAR(32) NOT NULL," .
- " real_name VARCHAR(64) NOT NULL," .
- " email VARCHAR(64) NOT NULL," .
- " password VARCHAR(128) NOT NULL," .
- " PRIMARY KEY (user_id)," .
- " UNIQUE KEY `##user_ix1` (user_name)," .
- " UNIQUE KEY `##user_ix2` (email)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##user_setting` (" .
- " user_id INTEGER NOT NULL," .
- " setting_name VARCHAR(32) NOT NULL," .
- " setting_value VARCHAR(255) NOT NULL," .
- " PRIMARY KEY (user_id, setting_name)," .
- " FOREIGN KEY `##user_setting_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE CASCADE */" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##user_gedcom_setting` (" .
- " user_id INTEGER NOT NULL," .
- " gedcom_id INTEGER NOT NULL," .
- " setting_name VARCHAR(32) NOT NULL," .
- " setting_value VARCHAR(255) NOT NULL," .
- " PRIMARY KEY (user_id, gedcom_id, setting_name)," .
- " FOREIGN KEY `##user_gedcom_setting_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE CASCADE */," .
- " FOREIGN KEY `##user_gedcom_setting_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##log` (" .
- " log_id INTEGER AUTO_INCREMENT NOT NULL," .
- " log_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," .
- " log_type ENUM('auth', 'config', 'debug', 'edit', 'error', 'media', 'search') NOT NULL," .
- " log_message TEXT NOT NULL," .
- " ip_address VARCHAR(40) NOT NULL," .
- " user_id INTEGER NULL," .
- " gedcom_id INTEGER NULL," .
- " PRIMARY KEY (log_id)," .
- " KEY `##log_ix1` (log_time)," .
- " KEY `##log_ix2` (log_type)," .
- " KEY `##log_ix3` (ip_address)," .
- " FOREIGN KEY `##log_fk1` (user_id) REFERENCES `##user`(user_id) /* ON DELETE SET NULL */," .
- " FOREIGN KEY `##log_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE SET NULL */" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##change` (" .
- " change_id INTEGER AUTO_INCREMENT NOT NULL," .
- " change_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," .
- " status ENUM('accepted', 'pending', 'rejected') NOT NULL DEFAULT 'pending'," .
- " gedcom_id INTEGER NOT NULL," .
- " xref VARCHAR(20) NOT NULL," .
- " old_gedcom MEDIUMTEXT NOT NULL," .
- " new_gedcom MEDIUMTEXT NOT NULL," .
- " user_id INTEGER NOT NULL," .
- " PRIMARY KEY (change_id)," .
- " KEY `##change_ix1` (gedcom_id, status, xref)," .
- " FOREIGN KEY `##change_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE RESTRICT */," .
- " FOREIGN KEY `##change_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##message` (" .
- " message_id INTEGER AUTO_INCREMENT NOT NULL," .
- " sender VARCHAR(64) NOT NULL," . // username or email address
- " ip_address VARCHAR(40) NOT NULL," . // long enough for IPv6
- " user_id INTEGER NOT NULL," .
- " subject VARCHAR(255) NOT NULL," .
- " body TEXT NOT NULL," .
- " created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," .
- " PRIMARY KEY (message_id)," .
- " FOREIGN KEY `##message_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE RESTRICT */" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##default_resn` (" .
- " default_resn_id INTEGER AUTO_INCREMENT NOT NULL," .
- " gedcom_id INTEGER NOT NULL," .
- " xref VARCHAR(20) NULL," .
- " tag_type VARCHAR(15) NULL," .
- " resn ENUM ('none', 'privacy', 'confidential', 'hidden') NOT NULL," .
- " comment VARCHAR(255) NULL," .
- " updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," .
- " PRIMARY KEY (default_resn_id)," .
- " UNIQUE KEY `##default_resn_ix1` (gedcom_id, xref, tag_type)," .
- " FOREIGN KEY `##default_resn_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id)" .
- ") ENGINE=InnoDB COLLATE=utf8_unicode_ci"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##individuals` (" .
- " i_id VARCHAR(20) NOT NULL," .
- " i_file INTEGER NOT NULL," .
- " i_rin VARCHAR(20) NOT NULL," .
- " i_sex ENUM('U', 'M', 'F') NOT NULL," .
- " i_gedcom MEDIUMTEXT NOT NULL," .
- " PRIMARY KEY (i_id, i_file)," .
- " UNIQUE KEY `##individuals_ix1` (i_file, i_id)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##families` (" .
- " f_id VARCHAR(20) NOT NULL," .
- " f_file INTEGER NOT NULL," .
- " f_husb VARCHAR(20) NULL," .
- " f_wife VARCHAR(20) NULL," .
- " f_gedcom MEDIUMTEXT NOT NULL," .
- " f_numchil INTEGER NOT NULL," .
- " PRIMARY KEY (f_id, f_file)," .
- " UNIQUE KEY `##families_ix1` (f_file, f_id)," .
- " KEY `##families_ix2` (f_husb)," .
- " KEY `##families_ix3` (f_wife)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##places` (" .
- " p_id INTEGER AUTO_INCREMENT NOT NULL," .
- " p_place VARCHAR(150) NULL," .
- " p_parent_id INTEGER NULL," .
- " p_file INTEGER NOT NULL," .
- " p_std_soundex TEXT NULL," .
- " p_dm_soundex TEXT NULL," .
- " PRIMARY KEY (p_id)," .
- " KEY `##places_ix1` (p_file, p_place)," .
- " UNIQUE KEY `##places_ix2` (p_parent_id, p_file, p_place)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##placelinks` (" .
- " pl_p_id INTEGER NOT NULL," .
- " pl_gid VARCHAR(20) NOT NULL," .
- " pl_file INTEGER NOT NULL," .
- " PRIMARY KEY (pl_p_id, pl_gid, pl_file)," .
- " KEY `##placelinks_ix1` (pl_p_id)," .
- " KEY `##placelinks_ix2` (pl_gid)," .
- " KEY `##placelinks_ix3` (pl_file)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##dates` (" .
- " d_day TINYINT NOT NULL," .
- " d_month CHAR(5) NULL," .
- " d_mon TINYINT NOT NULL," .
- " d_year SMALLINT NOT NULL," .
- " d_julianday1 MEDIUMINT NOT NULL," .
- " d_julianday2 MEDIUMINT NOT NULL," .
- " d_fact VARCHAR(15) NOT NULL," .
- " d_gid VARCHAR(20) NOT NULL," .
- " d_file INTEGER NOT NULL," .
- " d_type ENUM ('@#DGREGORIAN@', '@#DJULIAN@', '@#DHEBREW@', '@#DFRENCH R@', '@#DHIJRI@', '@#DROMAN@', '@#DJALALI@') NOT NULL," .
- " KEY `##dates_ix1` (d_day)," .
- " KEY `##dates_ix2` (d_month)," .
- " KEY `##dates_ix3` (d_mon)," .
- " KEY `##dates_ix4` (d_year)," .
- " KEY `##dates_ix5` (d_julianday1)," .
- " KEY `##dates_ix6` (d_julianday2)," .
- " KEY `##dates_ix7` (d_gid)," .
- " KEY `##dates_ix8` (d_file)," .
- " KEY `##dates_ix9` (d_type)," .
- " KEY `##dates_ix10` (d_fact, d_gid)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##media` (" .
- " m_id VARCHAR(20) NOT NULL," .
- " m_ext VARCHAR(6) NULL," .
- " m_type VARCHAR(20) NULL," .
- " m_titl VARCHAR(255) NULL," .
- " m_filename VARCHAR(512) NULL," .
- " m_file INTEGER NOT NULL," .
- " m_gedcom MEDIUMTEXT NULL," .
- " PRIMARY KEY (m_file, m_id)," .
- " UNIQUE KEY `##media_ix1` (m_id, m_file)," .
- " KEY `##media_ix2` (m_ext, m_type)," .
- " KEY `##media_ix3` (m_titl)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##next_id` (" .
- " gedcom_id INTEGER NOT NULL," .
- " record_type VARCHAR(15) NOT NULL," .
- " next_id DECIMAL(20) NOT NULL," .
- " PRIMARY KEY (gedcom_id, record_type)," .
- " FOREIGN KEY `##next_id_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##other` (" .
- " o_id VARCHAR(20) NOT NULL," .
- " o_file INTEGER NOT NULL," .
- " o_type VARCHAR(15) NOT NULL," .
- " o_gedcom MEDIUMTEXT NULL," .
- " PRIMARY KEY (o_id, o_file)," .
- " UNIQUE KEY `##other_ix1` (o_file, o_id)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##sources` (" .
- " s_id VARCHAR(20) NOT NULL," .
- " s_file INTEGER NOT NULL," .
- " s_name VARCHAR(255) NOT NULL," .
- " s_gedcom MEDIUMTEXT NOT NULL," .
- " PRIMARY KEY (s_id, s_file)," .
- " UNIQUE KEY `##sources_ix1` (s_file, s_id)," .
- " KEY `##sources_ix2` (s_name)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##link` (" .
- " l_file INTEGER NOT NULL," .
- " l_from VARCHAR(20) NOT NULL," .
- " l_type VARCHAR(15) NOT NULL," .
- " l_to VARCHAR(20) NOT NULL," .
- " PRIMARY KEY (l_from, l_file, l_type, l_to)," .
- " UNIQUE KEY `##link_ix1` (l_to, l_file, l_type, l_from)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##name` (" .
- " n_file INTEGER NOT NULL," .
- " n_id VARCHAR(20) NOT NULL," .
- " n_num INTEGER NOT NULL," .
- " n_type VARCHAR(15) NOT NULL," .
- " n_sort VARCHAR(255) NOT NULL," . // e.g. “GOGH,VINCENT WILLEM”
- " n_full VARCHAR(255) NOT NULL," . // e.g. “Vincent Willem van GOGH”
- // These fields are only used for INDI records
- " n_surname VARCHAR(255) NULL," . // e.g. “van GOGH”
- " n_surn VARCHAR(255) NULL," . // e.g. “GOGH”
- " n_givn VARCHAR(255) NULL," . // e.g. “Vincent Willem”
- " n_soundex_givn_std VARCHAR(255) NULL," .
- " n_soundex_surn_std VARCHAR(255) NULL," .
- " n_soundex_givn_dm VARCHAR(255) NULL," .
- " n_soundex_surn_dm VARCHAR(255) NULL," .
- " PRIMARY KEY (n_id, n_file, n_num)," .
- " KEY `##name_ix1` (n_full, n_id, n_file)," .
- " KEY `##name_ix2` (n_surn, n_file, n_type, n_id)," .
- " KEY `##name_ix3` (n_givn, n_file, n_type, n_id)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##module` (" .
- " module_name VARCHAR(32) NOT NULL," .
- " status ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled'," .
- " tab_order INTEGER NULL, " .
- " menu_order INTEGER NULL, " .
- " sidebar_order INTEGER NULL," .
- " PRIMARY KEY (module_name)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##module_setting` (" .
- " module_name VARCHAR(32) NOT NULL," .
- " setting_name VARCHAR(32) NOT NULL," .
- " setting_value MEDIUMTEXT NOT NULL," .
- " PRIMARY KEY (module_name, setting_name)," .
- " FOREIGN KEY `##module_setting_fk1` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##module_privacy` (" .
- " module_name VARCHAR(32) NOT NULL," .
- " gedcom_id INTEGER NOT NULL," .
- " component ENUM('block', 'chart', 'menu', 'report', 'sidebar', 'tab', 'theme') NOT NULL," .
- " access_level TINYINT NOT NULL," .
- " PRIMARY KEY (module_name, gedcom_id, component)," .
- " FOREIGN KEY `##module_privacy_fk1` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */," .
- " FOREIGN KEY `##module_privacy_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##block` (" .
- " block_id INTEGER AUTO_INCREMENT NOT NULL," .
- " gedcom_id INTEGER NULL," .
- " user_id INTEGER NULL," .
- " xref VARCHAR(20) NULL," .
- " location ENUM('main', 'side') NULL," .
- " block_order INTEGER NOT NULL," .
- " module_name VARCHAR(32) NOT NULL," .
- " PRIMARY KEY (block_id)," .
- " FOREIGN KEY `##block_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id), /* ON DELETE CASCADE */" .
- " FOREIGN KEY `##block_fk2` (user_id) REFERENCES `##user` (user_id), /* ON DELETE CASCADE */" .
- " FOREIGN KEY `##block_fk3` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##block_setting` (" .
- " block_id INTEGER NOT NULL," .
- " setting_name VARCHAR(32) NOT NULL," .
- " setting_value TEXT NOT NULL," .
- " PRIMARY KEY (block_id, setting_name)," .
- " FOREIGN KEY `##block_setting_fk1` (block_id) REFERENCES `##block` (block_id) /* ON DELETE CASCADE */" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##hit_counter` (" .
- " gedcom_id INTEGER NOT NULL," .
- " page_name VARCHAR(32) NOT NULL," .
- " page_parameter VARCHAR(32) NOT NULL," .
- " page_count INTEGER NOT NULL," .
- " PRIMARY KEY (gedcom_id, page_name, page_parameter)," .
- " FOREIGN KEY `##hit_counter_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
+class Migration0 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##gedcom` (" .
+ " gedcom_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " gedcom_name VARCHAR(255) NOT NULL," .
+ " sort_order INTEGER NOT NULL DEFAULT 0," .
+ " PRIMARY KEY (gedcom_id)," .
+ " UNIQUE KEY `##gedcom_ix1` (gedcom_name)," .
+ " KEY `##gedcom_ix2` (sort_order)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##site_setting` (" .
+ " setting_name VARCHAR(32) NOT NULL," .
+ " setting_value VARCHAR(255) NOT NULL," .
+ " PRIMARY KEY (setting_name)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##gedcom_setting` (" .
+ " gedcom_id INTEGER NOT NULL," .
+ " setting_name VARCHAR(32) NOT NULL," .
+ " setting_value VARCHAR(255) NOT NULL," .
+ " PRIMARY KEY (gedcom_id, setting_name)," .
+ " FOREIGN KEY `##gedcom_setting_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##user` (" .
+ " user_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " user_name VARCHAR(32) NOT NULL," .
+ " real_name VARCHAR(64) NOT NULL," .
+ " email VARCHAR(64) NOT NULL," .
+ " password VARCHAR(128) NOT NULL," .
+ " PRIMARY KEY (user_id)," .
+ " UNIQUE KEY `##user_ix1` (user_name)," .
+ " UNIQUE KEY `##user_ix2` (email)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##user_setting` (" .
+ " user_id INTEGER NOT NULL," .
+ " setting_name VARCHAR(32) NOT NULL," .
+ " setting_value VARCHAR(255) NOT NULL," .
+ " PRIMARY KEY (user_id, setting_name)," .
+ " FOREIGN KEY `##user_setting_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE CASCADE */" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##user_gedcom_setting` (" .
+ " user_id INTEGER NOT NULL," .
+ " gedcom_id INTEGER NOT NULL," .
+ " setting_name VARCHAR(32) NOT NULL," .
+ " setting_value VARCHAR(255) NOT NULL," .
+ " PRIMARY KEY (user_id, gedcom_id, setting_name)," .
+ " FOREIGN KEY `##user_gedcom_setting_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE CASCADE */," .
+ " FOREIGN KEY `##user_gedcom_setting_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##log` (" .
+ " log_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " log_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," .
+ " log_type ENUM('auth', 'config', 'debug', 'edit', 'error', 'media', 'search') NOT NULL," .
+ " log_message TEXT NOT NULL," .
+ " ip_address VARCHAR(40) NOT NULL," .
+ " user_id INTEGER NULL," .
+ " gedcom_id INTEGER NULL," .
+ " PRIMARY KEY (log_id)," .
+ " KEY `##log_ix1` (log_time)," .
+ " KEY `##log_ix2` (log_type)," .
+ " KEY `##log_ix3` (ip_address)," .
+ " FOREIGN KEY `##log_fk1` (user_id) REFERENCES `##user`(user_id) /* ON DELETE SET NULL */," .
+ " FOREIGN KEY `##log_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE SET NULL */" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##change` (" .
+ " change_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " change_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," .
+ " status ENUM('accepted', 'pending', 'rejected') NOT NULL DEFAULT 'pending'," .
+ " gedcom_id INTEGER NOT NULL," .
+ " xref VARCHAR(20) NOT NULL," .
+ " old_gedcom MEDIUMTEXT NOT NULL," .
+ " new_gedcom MEDIUMTEXT NOT NULL," .
+ " user_id INTEGER NOT NULL," .
+ " PRIMARY KEY (change_id)," .
+ " KEY `##change_ix1` (gedcom_id, status, xref)," .
+ " FOREIGN KEY `##change_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE RESTRICT */," .
+ " FOREIGN KEY `##change_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##message` (" .
+ " message_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " sender VARCHAR(64) NOT NULL," . // username or email address
+ " ip_address VARCHAR(40) NOT NULL," . // long enough for IPv6
+ " user_id INTEGER NOT NULL," .
+ " subject VARCHAR(255) NOT NULL," .
+ " body TEXT NOT NULL," .
+ " created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," .
+ " PRIMARY KEY (message_id)," .
+ " FOREIGN KEY `##message_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE RESTRICT */" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##default_resn` (" .
+ " default_resn_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " gedcom_id INTEGER NOT NULL," .
+ " xref VARCHAR(20) NULL," .
+ " tag_type VARCHAR(15) NULL," .
+ " resn ENUM ('none', 'privacy', 'confidential', 'hidden') NOT NULL," .
+ " comment VARCHAR(255) NULL," .
+ " updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," .
+ " PRIMARY KEY (default_resn_id)," .
+ " UNIQUE KEY `##default_resn_ix1` (gedcom_id, xref, tag_type)," .
+ " FOREIGN KEY `##default_resn_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id)" .
+ ") ENGINE=InnoDB COLLATE=utf8_unicode_ci"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##individuals` (" .
+ " i_id VARCHAR(20) NOT NULL," .
+ " i_file INTEGER NOT NULL," .
+ " i_rin VARCHAR(20) NOT NULL," .
+ " i_sex ENUM('U', 'M', 'F') NOT NULL," .
+ " i_gedcom MEDIUMTEXT NOT NULL," .
+ " PRIMARY KEY (i_id, i_file)," .
+ " UNIQUE KEY `##individuals_ix1` (i_file, i_id)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##families` (" .
+ " f_id VARCHAR(20) NOT NULL," .
+ " f_file INTEGER NOT NULL," .
+ " f_husb VARCHAR(20) NULL," .
+ " f_wife VARCHAR(20) NULL," .
+ " f_gedcom MEDIUMTEXT NOT NULL," .
+ " f_numchil INTEGER NOT NULL," .
+ " PRIMARY KEY (f_id, f_file)," .
+ " UNIQUE KEY `##families_ix1` (f_file, f_id)," .
+ " KEY `##families_ix2` (f_husb)," .
+ " KEY `##families_ix3` (f_wife)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##places` (" .
+ " p_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " p_place VARCHAR(150) NULL," .
+ " p_parent_id INTEGER NULL," .
+ " p_file INTEGER NOT NULL," .
+ " p_std_soundex TEXT NULL," .
+ " p_dm_soundex TEXT NULL," .
+ " PRIMARY KEY (p_id)," .
+ " KEY `##places_ix1` (p_file, p_place)," .
+ " UNIQUE KEY `##places_ix2` (p_parent_id, p_file, p_place)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##placelinks` (" .
+ " pl_p_id INTEGER NOT NULL," .
+ " pl_gid VARCHAR(20) NOT NULL," .
+ " pl_file INTEGER NOT NULL," .
+ " PRIMARY KEY (pl_p_id, pl_gid, pl_file)," .
+ " KEY `##placelinks_ix1` (pl_p_id)," .
+ " KEY `##placelinks_ix2` (pl_gid)," .
+ " KEY `##placelinks_ix3` (pl_file)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##dates` (" .
+ " d_day TINYINT NOT NULL," .
+ " d_month CHAR(5) NULL," .
+ " d_mon TINYINT NOT NULL," .
+ " d_year SMALLINT NOT NULL," .
+ " d_julianday1 MEDIUMINT NOT NULL," .
+ " d_julianday2 MEDIUMINT NOT NULL," .
+ " d_fact VARCHAR(15) NOT NULL," .
+ " d_gid VARCHAR(20) NOT NULL," .
+ " d_file INTEGER NOT NULL," .
+ " d_type ENUM ('@#DGREGORIAN@', '@#DJULIAN@', '@#DHEBREW@', '@#DFRENCH R@', '@#DHIJRI@', '@#DROMAN@', '@#DJALALI@') NOT NULL," .
+ " KEY `##dates_ix1` (d_day)," .
+ " KEY `##dates_ix2` (d_month)," .
+ " KEY `##dates_ix3` (d_mon)," .
+ " KEY `##dates_ix4` (d_year)," .
+ " KEY `##dates_ix5` (d_julianday1)," .
+ " KEY `##dates_ix6` (d_julianday2)," .
+ " KEY `##dates_ix7` (d_gid)," .
+ " KEY `##dates_ix8` (d_file)," .
+ " KEY `##dates_ix9` (d_type)," .
+ " KEY `##dates_ix10` (d_fact, d_gid)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##media` (" .
+ " m_id VARCHAR(20) NOT NULL," .
+ " m_ext VARCHAR(6) NULL," .
+ " m_type VARCHAR(20) NULL," .
+ " m_titl VARCHAR(255) NULL," .
+ " m_filename VARCHAR(512) NULL," .
+ " m_file INTEGER NOT NULL," .
+ " m_gedcom MEDIUMTEXT NULL," .
+ " PRIMARY KEY (m_file, m_id)," .
+ " UNIQUE KEY `##media_ix1` (m_id, m_file)," .
+ " KEY `##media_ix2` (m_ext, m_type)," .
+ " KEY `##media_ix3` (m_titl)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##next_id` (" .
+ " gedcom_id INTEGER NOT NULL," .
+ " record_type VARCHAR(15) NOT NULL," .
+ " next_id DECIMAL(20) NOT NULL," .
+ " PRIMARY KEY (gedcom_id, record_type)," .
+ " FOREIGN KEY `##next_id_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##other` (" .
+ " o_id VARCHAR(20) NOT NULL," .
+ " o_file INTEGER NOT NULL," .
+ " o_type VARCHAR(15) NOT NULL," .
+ " o_gedcom MEDIUMTEXT NULL," .
+ " PRIMARY KEY (o_id, o_file)," .
+ " UNIQUE KEY `##other_ix1` (o_file, o_id)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##sources` (" .
+ " s_id VARCHAR(20) NOT NULL," .
+ " s_file INTEGER NOT NULL," .
+ " s_name VARCHAR(255) NOT NULL," .
+ " s_gedcom MEDIUMTEXT NOT NULL," .
+ " PRIMARY KEY (s_id, s_file)," .
+ " UNIQUE KEY `##sources_ix1` (s_file, s_id)," .
+ " KEY `##sources_ix2` (s_name)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##link` (" .
+ " l_file INTEGER NOT NULL," .
+ " l_from VARCHAR(20) NOT NULL," .
+ " l_type VARCHAR(15) NOT NULL," .
+ " l_to VARCHAR(20) NOT NULL," .
+ " PRIMARY KEY (l_from, l_file, l_type, l_to)," .
+ " UNIQUE KEY `##link_ix1` (l_to, l_file, l_type, l_from)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##name` (" .
+ " n_file INTEGER NOT NULL," .
+ " n_id VARCHAR(20) NOT NULL," .
+ " n_num INTEGER NOT NULL," .
+ " n_type VARCHAR(15) NOT NULL," .
+ " n_sort VARCHAR(255) NOT NULL," . // e.g. “GOGH,VINCENT WILLEM”
+ " n_full VARCHAR(255) NOT NULL," . // e.g. “Vincent Willem van GOGH”
+ // These fields are only used for INDI records
+ " n_surname VARCHAR(255) NULL," . // e.g. “van GOGH”
+ " n_surn VARCHAR(255) NULL," . // e.g. “GOGH”
+ " n_givn VARCHAR(255) NULL," . // e.g. “Vincent Willem”
+ " n_soundex_givn_std VARCHAR(255) NULL," .
+ " n_soundex_surn_std VARCHAR(255) NULL," .
+ " n_soundex_givn_dm VARCHAR(255) NULL," .
+ " n_soundex_surn_dm VARCHAR(255) NULL," .
+ " PRIMARY KEY (n_id, n_file, n_num)," .
+ " KEY `##name_ix1` (n_full, n_id, n_file)," .
+ " KEY `##name_ix2` (n_surn, n_file, n_type, n_id)," .
+ " KEY `##name_ix3` (n_givn, n_file, n_type, n_id)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##module` (" .
+ " module_name VARCHAR(32) NOT NULL," .
+ " status ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled'," .
+ " tab_order INTEGER NULL, " .
+ " menu_order INTEGER NULL, " .
+ " sidebar_order INTEGER NULL," .
+ " PRIMARY KEY (module_name)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##module_setting` (" .
+ " module_name VARCHAR(32) NOT NULL," .
+ " setting_name VARCHAR(32) NOT NULL," .
+ " setting_value MEDIUMTEXT NOT NULL," .
+ " PRIMARY KEY (module_name, setting_name)," .
+ " FOREIGN KEY `##module_setting_fk1` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##module_privacy` (" .
+ " module_name VARCHAR(32) NOT NULL," .
+ " gedcom_id INTEGER NOT NULL," .
+ " component ENUM('block', 'chart', 'menu', 'report', 'sidebar', 'tab', 'theme') NOT NULL," .
+ " access_level TINYINT NOT NULL," .
+ " PRIMARY KEY (module_name, gedcom_id, component)," .
+ " FOREIGN KEY `##module_privacy_fk1` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */," .
+ " FOREIGN KEY `##module_privacy_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##block` (" .
+ " block_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " gedcom_id INTEGER NULL," .
+ " user_id INTEGER NULL," .
+ " xref VARCHAR(20) NULL," .
+ " location ENUM('main', 'side') NULL," .
+ " block_order INTEGER NOT NULL," .
+ " module_name VARCHAR(32) NOT NULL," .
+ " PRIMARY KEY (block_id)," .
+ " FOREIGN KEY `##block_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id), /* ON DELETE CASCADE */" .
+ " FOREIGN KEY `##block_fk2` (user_id) REFERENCES `##user` (user_id), /* ON DELETE CASCADE */" .
+ " FOREIGN KEY `##block_fk3` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##block_setting` (" .
+ " block_id INTEGER NOT NULL," .
+ " setting_name VARCHAR(32) NOT NULL," .
+ " setting_value TEXT NOT NULL," .
+ " PRIMARY KEY (block_id, setting_name)," .
+ " FOREIGN KEY `##block_setting_fk1` (block_id) REFERENCES `##block` (block_id) /* ON DELETE CASCADE */" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##hit_counter` (" .
+ " gedcom_id INTEGER NOT NULL," .
+ " page_name VARCHAR(32) NOT NULL," .
+ " page_parameter VARCHAR(32) NOT NULL," .
+ " page_count INTEGER NOT NULL," .
+ " PRIMARY KEY (gedcom_id, page_name, page_parameter)," .
+ " FOREIGN KEY `##hit_counter_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
- // Set the default site preferences
- Site::setPreference('INDEX_DIRECTORY', 'data/');
- Site::setPreference('USE_REGISTRATION_MODULE', '1');
- Site::setPreference('ALLOW_USER_THEMES', '1');
- Site::setPreference('ALLOW_CHANGE_GEDCOM', '1');
- Site::setPreference('SESSION_TIME', '7200');
- Site::setPreference('SMTP_ACTIVE', 'internal');
- Site::setPreference('SMTP_HOST', 'localhost');
- Site::setPreference('SMTP_PORT', '25');
- Site::setPreference('SMTP_AUTH', '1');
- Site::setPreference('SMTP_SSL', 'none');
- Site::setPreference('SMTP_HELO', $_SERVER['SERVER_NAME']);
- Site::setPreference('SMTP_FROM_NAME', $_SERVER['SERVER_NAME']);
+ // Set the default site preferences
+ Site::setPreference('INDEX_DIRECTORY', 'data/');
+ Site::setPreference('USE_REGISTRATION_MODULE', '1');
+ Site::setPreference('ALLOW_USER_THEMES', '1');
+ Site::setPreference('ALLOW_CHANGE_GEDCOM', '1');
+ Site::setPreference('SESSION_TIME', '7200');
+ Site::setPreference('SMTP_ACTIVE', 'internal');
+ Site::setPreference('SMTP_HOST', 'localhost');
+ Site::setPreference('SMTP_PORT', '25');
+ Site::setPreference('SMTP_AUTH', '1');
+ Site::setPreference('SMTP_SSL', 'none');
+ Site::setPreference('SMTP_HELO', $_SERVER['SERVER_NAME']);
+ Site::setPreference('SMTP_FROM_NAME', $_SERVER['SERVER_NAME']);
- // Search for all installed modules, and enable them.
- Module::getInstalledModules('enabled');
- }
+ // Search for all installed modules, and enable them.
+ Module::getInstalledModules('enabled');
+ }
}
diff --git a/app/Schema/Migration1.php b/app/Schema/Migration1.php
index 31fb67ba48..3b0b7d1b56 100644
--- a/app/Schema/Migration1.php
+++ b/app/Schema/Migration1.php
@@ -20,24 +20,26 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 1 to version 2.
*/
-class Migration1 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Create the wt_session table to store session data in the database,
- // rather than in the filesystem.
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##session` (" .
- " session_id CHAR(32) NOT NULL," .
- " session_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," .
- " user_id INTEGER NOT NULL," .
- " ip_address VARCHAR(32) NOT NULL," .
- " session_data MEDIUMBLOB NOT NULL," .
- " PRIMARY KEY (session_id)," .
- " KEY ix1 (session_time)," .
- " KEY ix2 (user_id, ip_address)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- }
+class Migration1 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Create the wt_session table to store session data in the database,
+ // rather than in the filesystem.
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##session` (" .
+ " session_id CHAR(32) NOT NULL," .
+ " session_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," .
+ " user_id INTEGER NOT NULL," .
+ " ip_address VARCHAR(32) NOT NULL," .
+ " session_data MEDIUMBLOB NOT NULL," .
+ " PRIMARY KEY (session_id)," .
+ " KEY ix1 (session_time)," .
+ " KEY ix2 (user_id, ip_address)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ }
}
diff --git a/app/Schema/Migration10.php b/app/Schema/Migration10.php
index a28da995da..f4663481f5 100644
--- a/app/Schema/Migration10.php
+++ b/app/Schema/Migration10.php
@@ -20,15 +20,17 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 10 to version 11.
*/
-class Migration10 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Delete old configuration setting
- Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('SEARCH_FACTS_DEFAULT', 'DISPLAY_JEWISH_GERESHAYIM', 'DISPLAY_JEWISH_THOUSANDS')");
+class Migration10 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Delete old configuration setting
+ Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('SEARCH_FACTS_DEFAULT', 'DISPLAY_JEWISH_GERESHAYIM', 'DISPLAY_JEWISH_THOUSANDS')");
- // Increase the password column from 64 to 128 characters
- Database::exec("ALTER TABLE `##user` CHANGE password password VARCHAR(128) COLLATE utf8_unicode_ci NOT NULL");
- }
+ // Increase the password column from 64 to 128 characters
+ Database::exec("ALTER TABLE `##user` CHANGE password password VARCHAR(128) COLLATE utf8_unicode_ci NOT NULL");
+ }
}
diff --git a/app/Schema/Migration11.php b/app/Schema/Migration11.php
index 9316504cb7..5bd60d7230 100644
--- a/app/Schema/Migration11.php
+++ b/app/Schema/Migration11.php
@@ -22,25 +22,27 @@ use PDOException;
/**
* Upgrade the database schema from version 11 to version 12.
*/
-class Migration11 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // - delete the wt_name.n_list column; it has never been used
- // - a bug in webtrees 1.1.2 caused the wt_name.n_full column
- // to include slashes around the surname. These are unnecessary,
- // and cause problems when we try to match the name from the
- // gedcom with the name from the table.
- // Remove slashes from INDI names
- Database::exec("UPDATE `##name` SET n_full=REPLACE(n_full, '/', '') WHERE n_surn IS NOT NULL");
+class Migration11 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // - delete the wt_name.n_list column; it has never been used
+ // - a bug in webtrees 1.1.2 caused the wt_name.n_full column
+ // to include slashes around the surname. These are unnecessary,
+ // and cause problems when we try to match the name from the
+ // gedcom with the name from the table.
+ // Remove slashes from INDI names
+ Database::exec("UPDATE `##name` SET n_full=REPLACE(n_full, '/', '') WHERE n_surn IS NOT NULL");
- try {
- Database::exec("ALTER TABLE `##name` DROP n_list");
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+ try {
+ Database::exec("ALTER TABLE `##name` DROP n_list");
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Already done?
- }
- }
+ // Already done?
+ }
+ }
}
diff --git a/app/Schema/Migration12.php b/app/Schema/Migration12.php
index 1be42044c1..7edb1f7224 100644
--- a/app/Schema/Migration12.php
+++ b/app/Schema/Migration12.php
@@ -22,24 +22,26 @@ use PDOException;
/**
* Upgrade the database schema from version 12 to version 13.
*/
-class Migration12 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Delete old config settings
+class Migration12 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Delete old config settings
- // Convert MULTI_MEDIA (0=false, 1=true) to MEDIA_UPLOAD (1=members, 0=managers, -1=nobody)
- try {
- Database::exec("UPDATE `##gedcom_setting` SET setting_name='MEDIA_UPLOAD' WHERE setting_name='MULTI_MEDIA'");
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+ // Convert MULTI_MEDIA (0=false, 1=true) to MEDIA_UPLOAD (1=members, 0=managers, -1=nobody)
+ try {
+ Database::exec("UPDATE `##gedcom_setting` SET setting_name='MEDIA_UPLOAD' WHERE setting_name='MULTI_MEDIA'");
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // This could theoretically cause a duplicate key error, if a MULTI_MEDIA setting already exists
- }
+ // This could theoretically cause a duplicate key error, if a MULTI_MEDIA setting already exists
+ }
- // Remove old settings
- Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('SHOW_MEDIA_FILENAME', 'USE_THUMBS_MAIN', 'MULTI_MEDIA')");
- Database::exec("DELETE FROM `##default_resn` WHERE tag_type IN ('_PRIM')");
- }
+ // Remove old settings
+ Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('SHOW_MEDIA_FILENAME', 'USE_THUMBS_MAIN', 'MULTI_MEDIA')");
+ Database::exec("DELETE FROM `##default_resn` WHERE tag_type IN ('_PRIM')");
+ }
}
diff --git a/app/Schema/Migration13.php b/app/Schema/Migration13.php
index cfed77019f..39bd482d6e 100644
--- a/app/Schema/Migration13.php
+++ b/app/Schema/Migration13.php
@@ -22,18 +22,20 @@ use PDOException;
/**
* Upgrade the database schema from version 13 to version 14.
*/
-class Migration13 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Remove the i_isdead column
- try {
- Database::exec("ALTER TABLE `##individuals` DROP i_isdead");
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+class Migration13 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Remove the i_isdead column
+ try {
+ Database::exec("ALTER TABLE `##individuals` DROP i_isdead");
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Already done this?
- }
- }
+ // Already done this?
+ }
+ }
}
diff --git a/app/Schema/Migration14.php b/app/Schema/Migration14.php
index 2e62cc5523..bbbfd707ca 100644
--- a/app/Schema/Migration14.php
+++ b/app/Schema/Migration14.php
@@ -20,16 +20,18 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 14 to version 15.
*/
-class Migration14 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Delete old config settings
- Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN('GEDCOM_DEFAULT_TAB', 'LINK_ICONS', 'ZOOM_BOXES')");
- Database::exec("DELETE FROM `##user_setting` WHERE setting_name='default'");
+class Migration14 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Delete old config settings
+ Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN('GEDCOM_DEFAULT_TAB', 'LINK_ICONS', 'ZOOM_BOXES')");
+ Database::exec("DELETE FROM `##user_setting` WHERE setting_name='default'");
- // There is no way to add a RESN tag to NOTE objects
- Database::exec("UPDATE `##gedcom_setting` SET setting_value='SOUR,RESN' WHERE setting_name='NOTE_FACTS_ADD' AND setting_value='SOUR'");
- }
+ // There is no way to add a RESN tag to NOTE objects
+ Database::exec("UPDATE `##gedcom_setting` SET setting_value='SOUR,RESN' WHERE setting_name='NOTE_FACTS_ADD' AND setting_value='SOUR'");
+ }
}
diff --git a/app/Schema/Migration15.php b/app/Schema/Migration15.php
index 0b0002f2a5..99bc5792ac 100644
--- a/app/Schema/Migration15.php
+++ b/app/Schema/Migration15.php
@@ -20,24 +20,26 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 16 to version 17.
*/
-class Migration15 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Delete old config settings
- Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN('GEDCOM_DEFAULT_TAB', 'LINK_ICONS', 'ZOOM_BOXES', 'SHOW_LIST_PLACES', 'SHOW_CONTEXT_HELP')");
- Database::exec("DELETE FROM `##user_setting` WHERE setting_name='defaulttab'");
+class Migration15 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Delete old config settings
+ Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN('GEDCOM_DEFAULT_TAB', 'LINK_ICONS', 'ZOOM_BOXES', 'SHOW_LIST_PLACES', 'SHOW_CONTEXT_HELP')");
+ Database::exec("DELETE FROM `##user_setting` WHERE setting_name='defaulttab'");
- // There is no way to add a RESN tag to NOTE objects
- Database::exec("UPDATE `##gedcom_setting` SET setting_value='SOUR,RESN' WHERE setting_name='NOTE_FACTS_ADD' AND setting_value='SOUR'");
+ // There is no way to add a RESN tag to NOTE objects
+ Database::exec("UPDATE `##gedcom_setting` SET setting_value='SOUR,RESN' WHERE setting_name='NOTE_FACTS_ADD' AND setting_value='SOUR'");
- // This needs to be an absolute URL. If not set, it defaults to the full path to login.php
- Database::exec("DELETE FROM `##site_setting` WHERE setting_name='LOGIN_URL' AND setting_value='login.php'");
- // No need for an empty value
- Database::exec("DELETE FROM `##site_setting` WHERE setting_name='SERVER_URL' AND setting_value=''");
+ // This needs to be an absolute URL. If not set, it defaults to the full path to login.php
+ Database::exec("DELETE FROM `##site_setting` WHERE setting_name='LOGIN_URL' AND setting_value='login.php'");
+ // No need for an empty value
+ Database::exec("DELETE FROM `##site_setting` WHERE setting_name='SERVER_URL' AND setting_value=''");
- // Later PHP versions use session IDs longer than 32 chars.
- Database::exec("ALTER TABLE `##session` CHANGE session_id session_id CHAR(128) COLLATE utf8_unicode_ci NOT NULL");
- }
+ // Later PHP versions use session IDs longer than 32 chars.
+ Database::exec("ALTER TABLE `##session` CHANGE session_id session_id CHAR(128) COLLATE utf8_unicode_ci NOT NULL");
+ }
}
diff --git a/app/Schema/Migration16.php b/app/Schema/Migration16.php
index bd59e8b88c..e6523bd5ed 100644
--- a/app/Schema/Migration16.php
+++ b/app/Schema/Migration16.php
@@ -20,24 +20,26 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 16 to version 17.
*/
-class Migration16 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Add a "default" user, to store default settings
- Database::exec("INSERT IGNORE INTO `##user` (user_id, user_name, real_name, email, password) VALUES (-1, 'DEFAULT_USER', 'DEFAULT_USER', 'DEFAULT_USER', 'DEFAULT_USER')");
+class Migration16 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Add a "default" user, to store default settings
+ Database::exec("INSERT IGNORE INTO `##user` (user_id, user_name, real_name, email, password) VALUES (-1, 'DEFAULT_USER', 'DEFAULT_USER', 'DEFAULT_USER', 'DEFAULT_USER')");
- // Add the initial default block settings
- Database::exec("INSERT IGNORE INTO `##block` (user_id, location, block_order, module_name) VALUES (-1, 'main', 1, 'todays_events'), (-1, 'main', 2, 'user_messages'), (-1, 'main', 3, 'user_favorites'), (-1, 'side', 1, 'user_welcome'), (-1, 'side', 2, 'random_media'), (-1, 'side', 3, 'upcoming_events'), (-1, 'side', 4, 'logged_in')");
+ // Add the initial default block settings
+ Database::exec("INSERT IGNORE INTO `##block` (user_id, location, block_order, module_name) VALUES (-1, 'main', 1, 'todays_events'), (-1, 'main', 2, 'user_messages'), (-1, 'main', 3, 'user_favorites'), (-1, 'side', 1, 'user_welcome'), (-1, 'side', 2, 'random_media'), (-1, 'side', 3, 'upcoming_events'), (-1, 'side', 4, 'logged_in')");
- // Add a "default" tree, to store default settings
- Database::exec("INSERT IGNORE INTO `##gedcom` (gedcom_id, gedcom_name) VALUES (-1, 'DEFAULT_TREE')");
+ // Add a "default" tree, to store default settings
+ Database::exec("INSERT IGNORE INTO `##gedcom` (gedcom_id, gedcom_name) VALUES (-1, 'DEFAULT_TREE')");
- // Add the initial default block settings
- Database::exec("INSERT IGNORE INTO `##block` (gedcom_id, location, block_order, module_name) VALUES (-1, 'main', 1, 'gedcom_stats'), (-1, 'main', 2, 'gedcom_news'), (-1, 'main', 3, 'gedcom_favorites'), (-1, 'main', 4, 'review_changes'), (-1, 'side', 1, 'gedcom_block'), (-1, 'side', 2, 'random_media'), (-1, 'side', 3, 'todays_events'), (-1, 'side', 4, 'logged_in')");
+ // Add the initial default block settings
+ Database::exec("INSERT IGNORE INTO `##block` (gedcom_id, location, block_order, module_name) VALUES (-1, 'main', 1, 'gedcom_stats'), (-1, 'main', 2, 'gedcom_news'), (-1, 'main', 3, 'gedcom_favorites'), (-1, 'main', 4, 'review_changes'), (-1, 'side', 1, 'gedcom_block'), (-1, 'side', 2, 'random_media'), (-1, 'side', 3, 'todays_events'), (-1, 'side', 4, 'logged_in')");
- // Some modules (e.g. sitemap) require larger settings
- Database::exec("ALTER TABLE `##module_setting` CHANGE setting_value setting_value MEDIUMTEXT COLLATE utf8_unicode_ci NOT NULL");
- }
+ // Some modules (e.g. sitemap) require larger settings
+ Database::exec("ALTER TABLE `##module_setting` CHANGE setting_value setting_value MEDIUMTEXT COLLATE utf8_unicode_ci NOT NULL");
+ }
}
diff --git a/app/Schema/Migration17.php b/app/Schema/Migration17.php
index 35b2324d0d..7e083e366d 100644
--- a/app/Schema/Migration17.php
+++ b/app/Schema/Migration17.php
@@ -18,12 +18,14 @@ namespace Fisharebest\Webtrees\Schema;
/**
* Upgrade the database schema from version 17 to version 18.
*/
-class Migration17 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Originally, this created wt_site_access_rule,
- // however this table now gets deleted in Migration37.
- }
+class Migration17 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Originally, this created wt_site_access_rule,
+ // however this table now gets deleted in Migration37.
+ }
}
diff --git a/app/Schema/Migration18.php b/app/Schema/Migration18.php
index 60342f631c..74dcc1f404 100644
--- a/app/Schema/Migration18.php
+++ b/app/Schema/Migration18.php
@@ -22,27 +22,29 @@ use PDOException;
/**
* Upgrade the database schema from version 18 to version 19.
*/
-class Migration18 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Update some indexes, based on analysis of slow-query-logs
- try {
- Database::exec(
- "ALTER TABLE `##places`" .
- " DROP KEY ix1," .
- " DROP KEY ix2," .
- " DROP KEY ix3," .
- " DROP KEY ix4," .
- " DROP p_level," . // Not needed - implicit from p_parent
- " ADD KEY ix1 (p_file, p_place)," . // autocomplete.php
- " ADD UNIQUE KEY ux1 (p_parent_id, p_file, p_place)" // placelist.php
- );
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+class Migration18 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Update some indexes, based on analysis of slow-query-logs
+ try {
+ Database::exec(
+ "ALTER TABLE `##places`" .
+ " DROP KEY ix1," .
+ " DROP KEY ix2," .
+ " DROP KEY ix3," .
+ " DROP KEY ix4," .
+ " DROP p_level," . // Not needed - implicit from p_parent
+ " ADD KEY ix1 (p_file, p_place)," . // autocomplete.php
+ " ADD UNIQUE KEY ux1 (p_parent_id, p_file, p_place)" // placelist.php
+ );
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Already done?
- }
- }
+ // Already done?
+ }
+ }
}
diff --git a/app/Schema/Migration19.php b/app/Schema/Migration19.php
index 3f0fdc14e0..43c95612d6 100644
--- a/app/Schema/Migration19.php
+++ b/app/Schema/Migration19.php
@@ -20,13 +20,15 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 19 to version 20.
*/
-class Migration19 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Fix some broken data caused by a bug
- Database::exec("UPDATE `##default_resn` SET xref = NULL WHERE xref = ''");
- Database::exec("UPDATE `##default_resn` SET tag_type = NULL WHERE tag_type = ''");
- }
+class Migration19 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Fix some broken data caused by a bug
+ Database::exec("UPDATE `##default_resn` SET xref = NULL WHERE xref = ''");
+ Database::exec("UPDATE `##default_resn` SET tag_type = NULL WHERE tag_type = ''");
+ }
}
diff --git a/app/Schema/Migration2.php b/app/Schema/Migration2.php
index 8352aae5af..d0f35be514 100644
--- a/app/Schema/Migration2.php
+++ b/app/Schema/Migration2.php
@@ -22,34 +22,36 @@ use PDOException;
/**
* Upgrade the database schema from version 2 to version 2.
*/
-class Migration2 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // - create the wt_gedcom_chunk table to import gedcoms in
- // blocks of data smaller than the max_allowed_packet restriction.
+class Migration2 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // - create the wt_gedcom_chunk table to import gedcoms in
+ // blocks of data smaller than the max_allowed_packet restriction.
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##gedcom_chunk` (" .
- " gedcom_chunk_id INTEGER AUTO_INCREMENT NOT NULL," .
- " gedcom_id INTEGER NOT NULL," .
- " chunk_data MEDIUMBLOB NOT NULL," .
- " imported BOOLEAN NOT NULL DEFAULT FALSE," .
- " PRIMARY KEY (gedcom_chunk_id)," .
- " KEY ix1 (gedcom_id, imported)," .
- " FOREIGN KEY `##gedcom_chunk_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##gedcom_chunk` (" .
+ " gedcom_chunk_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " gedcom_id INTEGER NOT NULL," .
+ " chunk_data MEDIUMBLOB NOT NULL," .
+ " imported BOOLEAN NOT NULL DEFAULT FALSE," .
+ " PRIMARY KEY (gedcom_chunk_id)," .
+ " KEY ix1 (gedcom_id, imported)," .
+ " FOREIGN KEY `##gedcom_chunk_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
- try {
- Database::exec(
- "ALTER TABLE `##gedcom` DROP import_gedcom, DROP import_offset"
- );
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+ try {
+ Database::exec(
+ "ALTER TABLE `##gedcom` DROP import_gedcom, DROP import_offset"
+ );
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Perhaps we have already deleted these columns?
- }
- }
+ // Perhaps we have already deleted these columns?
+ }
+ }
}
diff --git a/app/Schema/Migration20.php b/app/Schema/Migration20.php
index d4b416e92c..fcdc76d159 100644
--- a/app/Schema/Migration20.php
+++ b/app/Schema/Migration20.php
@@ -22,38 +22,40 @@ use PDOException;
/**
* Upgrade the database schema from version 20 to version 21.
*/
-class Migration20 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Delete some old/unused configuration settings
- Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('MEDIA_EXTERNAL')");
+class Migration20 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Delete some old/unused configuration settings
+ Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('MEDIA_EXTERNAL')");
- // Delete old table
- Database::exec("DROP TABLE IF EXISTS `##media_mapping`");
+ // Delete old table
+ Database::exec("DROP TABLE IF EXISTS `##media_mapping`");
- // Make this table look like all the others
- try {
- Database::exec(
- "ALTER TABLE `##media`" .
- " DROP m_id," .
- " CHANGE m_media m_id VARCHAR(20) COLLATE utf8_unicode_ci NOT NULL," .
- " CHANGE m_file m_filename VARCHAR(512) COLLATE utf8_unicode_ci DEFAULT NULL," .
- " CHANGE m_gedfile m_file INTEGER NOT NULL," .
- " CHANGE m_gedrec m_gedcom MEDIUMTEXT COLLATE utf8_unicode_ci DEFAULT NULL," .
- " ADD m_type VARCHAR(20) COLLATE utf8_unicode_ci NULL AFTER m_ext," .
- " ADD PRIMARY KEY (m_file, m_id)," .
- " ADD KEY ix2 (m_ext, m_type)," .
- " ADD KEY ix3 (m_titl)"
- );
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+ // Make this table look like all the others
+ try {
+ Database::exec(
+ "ALTER TABLE `##media`" .
+ " DROP m_id," .
+ " CHANGE m_media m_id VARCHAR(20) COLLATE utf8_unicode_ci NOT NULL," .
+ " CHANGE m_file m_filename VARCHAR(512) COLLATE utf8_unicode_ci DEFAULT NULL," .
+ " CHANGE m_gedfile m_file INTEGER NOT NULL," .
+ " CHANGE m_gedrec m_gedcom MEDIUMTEXT COLLATE utf8_unicode_ci DEFAULT NULL," .
+ " ADD m_type VARCHAR(20) COLLATE utf8_unicode_ci NULL AFTER m_ext," .
+ " ADD PRIMARY KEY (m_file, m_id)," .
+ " ADD KEY ix2 (m_ext, m_type)," .
+ " ADD KEY ix3 (m_titl)"
+ );
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Assume we've already done this
- }
+ // Assume we've already done this
+ }
- // Populate the new column
- Database::exec("UPDATE `##media` SET m_type = SUBSTRING_INDEX(SUBSTRING_INDEX(m_gedcom, '\n3 TYPE ', -1), '\n', 1) WHERE m_gedcom LIKE '%\n3 TYPE %'");
- }
+ // Populate the new column
+ Database::exec("UPDATE `##media` SET m_type = SUBSTRING_INDEX(SUBSTRING_INDEX(m_gedcom, '\n3 TYPE ', -1), '\n', 1) WHERE m_gedcom LIKE '%\n3 TYPE %'");
+ }
}
diff --git a/app/Schema/Migration21.php b/app/Schema/Migration21.php
index 799d6f21a4..936fa83985 100644
--- a/app/Schema/Migration21.php
+++ b/app/Schema/Migration21.php
@@ -20,50 +20,52 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 21 to version 22.
*/
-class Migration21 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Data fix for bug #1072477
- Database::exec("UPDATE `##default_resn` SET xref = NULL WHERE xref = ''");
- Database::exec("UPDATE `##default_resn` SET tag_type = NULL WHERE tag_type = ''");
+class Migration21 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Data fix for bug #1072477
+ Database::exec("UPDATE `##default_resn` SET xref = NULL WHERE xref = ''");
+ Database::exec("UPDATE `##default_resn` SET tag_type = NULL WHERE tag_type = ''");
- // Delete old settings
- Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('AUTO_GENERATE_THUMBS', 'POSTAL_CODE', 'MEDIA_DIRECTORY_LEVELS', 'USE_MEDIA_VIEWER')");
+ // Delete old settings
+ Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('AUTO_GENERATE_THUMBS', 'POSTAL_CODE', 'MEDIA_DIRECTORY_LEVELS', 'USE_MEDIA_VIEWER')");
- // Delete old settings
- Database::exec("DELETE FROM `##module_setting` WHERE module_name='lightbox'");
+ // Delete old settings
+ Database::exec("DELETE FROM `##module_setting` WHERE module_name='lightbox'");
- // Very old versions of phpGedView allowed media paths beginning “./”
- // Remove these
- Database::exec(
- "UPDATE `##media` m" .
- " SET" .
- " m_filename = TRIM(LEADING './' FROM m_filename)," .
- " m_gedcom = REPLACE(m_gedcom, '\n1 FILE ./', '\n1 FILE ')"
- );
- Database::exec(
- "UPDATE `##change` c" .
- " SET new_gedcom = REPLACE(new_gedcom, '\n1 FILE ./', '\n1 FILE ')" .
- " WHERE status = 'pending'"
- );
+ // Very old versions of phpGedView allowed media paths beginning “./”
+ // Remove these
+ Database::exec(
+ "UPDATE `##media` m" .
+ " SET" .
+ " m_filename = TRIM(LEADING './' FROM m_filename)," .
+ " m_gedcom = REPLACE(m_gedcom, '\n1 FILE ./', '\n1 FILE ')"
+ );
+ Database::exec(
+ "UPDATE `##change` c" .
+ " SET new_gedcom = REPLACE(new_gedcom, '\n1 FILE ./', '\n1 FILE ')" .
+ " WHERE status = 'pending'"
+ );
- // Previous versions of webtrees included the MEDIA_DIRECTORY setting in the
- // FILE tag of the OBJE records. Remove it…
- Database::exec(
- "UPDATE `##media` m" .
- " JOIN `##gedcom_setting` gs ON (m.m_file = gs.gedcom_id AND gs.setting_name = 'MEDIA_DIRECTORY')" .
- " SET" .
- " m_filename = TRIM(LEADING gs.setting_value FROM m_filename)," .
- " m_gedcom = REPLACE(m_gedcom, CONCAT('\n1 FILE ', gs.setting_value), '\n1 FILE ')"
- );
- // …don’t forget pending changes
- Database::exec(
- "UPDATE `##change` c" .
- " JOIN `##gedcom_setting` gs ON (c.gedcom_id = gs.gedcom_id AND gs.setting_name = 'MEDIA_DIRECTORY')" .
- " SET new_gedcom = REPLACE(new_gedcom, CONCAT('\n1 FILE ', gs.setting_value), '\n1 FILE ')" .
- " WHERE status = 'pending'"
- );
- }
+ // Previous versions of webtrees included the MEDIA_DIRECTORY setting in the
+ // FILE tag of the OBJE records. Remove it…
+ Database::exec(
+ "UPDATE `##media` m" .
+ " JOIN `##gedcom_setting` gs ON (m.m_file = gs.gedcom_id AND gs.setting_name = 'MEDIA_DIRECTORY')" .
+ " SET" .
+ " m_filename = TRIM(LEADING gs.setting_value FROM m_filename)," .
+ " m_gedcom = REPLACE(m_gedcom, CONCAT('\n1 FILE ', gs.setting_value), '\n1 FILE ')"
+ );
+ // …don’t forget pending changes
+ Database::exec(
+ "UPDATE `##change` c" .
+ " JOIN `##gedcom_setting` gs ON (c.gedcom_id = gs.gedcom_id AND gs.setting_name = 'MEDIA_DIRECTORY')" .
+ " SET new_gedcom = REPLACE(new_gedcom, CONCAT('\n1 FILE ', gs.setting_value), '\n1 FILE ')" .
+ " WHERE status = 'pending'"
+ );
+ }
}
diff --git a/app/Schema/Migration22.php b/app/Schema/Migration22.php
index 1c8554785f..4e5495015a 100644
--- a/app/Schema/Migration22.php
+++ b/app/Schema/Migration22.php
@@ -23,77 +23,82 @@ use Throwable;
/**
* Upgrade the database schema from version 22 to version 23.
*/
-class Migration22 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // - data update for 1.4.0 media changes
- $_cfgs = Database::prepare(
- "SELECT gs1.gedcom_id AS gedcom_id, gs1.setting_value AS media_directory, gs2.setting_value AS use_media_firewall, gs3.setting_value AS media_firewall_thumbs, gs4.setting_value AS media_firewall_rootdir" .
- " FROM `##gedcom_setting` gs1" .
- " LEFT JOIN `##gedcom_setting` gs2 ON (gs1.gedcom_id = gs2.gedcom_id AND gs2.setting_name='USE_MEDIA_FIREWALL')" .
- " LEFT JOIN `##gedcom_setting` gs3 ON (gs1.gedcom_id = gs3.gedcom_id AND gs3.setting_name='MEDIA_FIREWALL_THUMBS')" .
- " LEFT JOIN `##gedcom_setting` gs4 ON (gs1.gedcom_id = gs4.gedcom_id AND gs4.setting_name='MEDIA_FIREWALL_ROOTDIR')" .
- " WHERE gs1.setting_name = 'MEDIA_DIRECTORY'"
- )->fetchAll();
+class Migration22 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // - data update for 1.4.0 media changes
+ $_cfgs = Database::prepare(
+ "SELECT gs1.gedcom_id AS gedcom_id, gs1.setting_value AS media_directory, gs2.setting_value AS use_media_firewall, gs3.setting_value AS media_firewall_thumbs, gs4.setting_value AS media_firewall_rootdir" .
+ " FROM `##gedcom_setting` gs1" .
+ " LEFT JOIN `##gedcom_setting` gs2 ON (gs1.gedcom_id = gs2.gedcom_id AND gs2.setting_name='USE_MEDIA_FIREWALL')" .
+ " LEFT JOIN `##gedcom_setting` gs3 ON (gs1.gedcom_id = gs3.gedcom_id AND gs3.setting_name='MEDIA_FIREWALL_THUMBS')" .
+ " LEFT JOIN `##gedcom_setting` gs4 ON (gs1.gedcom_id = gs4.gedcom_id AND gs4.setting_name='MEDIA_FIREWALL_ROOTDIR')" .
+ " WHERE gs1.setting_name = 'MEDIA_DIRECTORY'"
+ )->fetchAll();
- // The constant WT_DATA_DIR is not defined yet (although it was when this script was originally written).
- $WT_DATA_DIR = realpath('data');
+ // The constant WT_DATA_DIR is not defined yet (although it was when this script was originally written).
+ $WT_DATA_DIR = realpath('data');
- // Check the config for each tree
- foreach ($_cfgs as $_cfg) {
- if ($_cfg->use_media_firewall) {
- // We’re using the media firewall.
- $_mf_dir = realpath($_cfg->media_firewall_rootdir) . DIRECTORY_SEPARATOR;
- if ($_mf_dir == $WT_DATA_DIR) {
- // We’re already storing our media in the data folder - nothing to do.
- } else {
- // We’ve chosen a custom location for our media folder - need to update our media-folder to point to it.
- // We have, for example,
- // $_mf_dir = /home/fisharebest/my_pictures/
- // $WT_DATA_DIR = /home/fisharebest/public_html/webtrees/data/
- // Therefore we need to calculate ../../../my_pictures/
- $_media_dir = '';
- $_tmp_dir = $WT_DATA_DIR;
- while (strpos($_mf_dir, $_tmp_dir) !== 0) {
- $_media_dir .= '../';
- $_tmp_dir = preg_replace('~[^/\\\\]+[/\\\\]$~', '', $_tmp_dir);
- if ($_tmp_dir == '') {
- // Shouldn't get here - but this script is not allowed to fail...
- continue 2;
- }
- }
- $_media_dir .= $_cfg->media_directory;
- Database::prepare(
- "UPDATE `##gedcom_setting`" .
- " SET setting_value=?" .
- " WHERE gedcom_id=? AND setting_name='MEDIA_DIRECTORY'"
- )->execute([$_media_dir, $_cfg->gedcom_id]);
- }
- } else {
- // Not using the media firewall - just move the public folder to the new location (if we can).
- if (
- file_exists(WT_ROOT . $_cfg->media_directory) &&
- is_dir(WT_ROOT . $_cfg->media_directory) &&
- !file_exists($WT_DATA_DIR . $_cfg->media_directory)
- ) {
- try {
- rename(WT_ROOT . $_cfg->media_directory, $WT_DATA_DIR . $_cfg->media_directory);
- } catch (Throwable $ex) {
- DebugBar::addThrowable($ex);
+ // Check the config for each tree
+ foreach ($_cfgs as $_cfg) {
+ if ($_cfg->use_media_firewall) {
+ // We’re using the media firewall.
+ $_mf_dir = realpath($_cfg->media_firewall_rootdir) . DIRECTORY_SEPARATOR;
+ if ($_mf_dir == $WT_DATA_DIR) {
+ // We’re already storing our media in the data folder - nothing to do.
+ } else {
+ // We’ve chosen a custom location for our media folder - need to update our media-folder to point to it.
+ // We have, for example,
+ // $_mf_dir = /home/fisharebest/my_pictures/
+ // $WT_DATA_DIR = /home/fisharebest/public_html/webtrees/data/
+ // Therefore we need to calculate ../../../my_pictures/
+ $_media_dir = '';
+ $_tmp_dir = $WT_DATA_DIR;
+ while (strpos($_mf_dir, $_tmp_dir) !== 0) {
+ $_media_dir .= '../';
+ $_tmp_dir = preg_replace('~[^/\\\\]+[/\\\\]$~', '', $_tmp_dir);
+ if ($_tmp_dir == '') {
+ // Shouldn't get here - but this script is not allowed to fail...
+ continue 2;
+ }
+ }
+ $_media_dir .= $_cfg->media_directory;
+ Database::prepare(
+ "UPDATE `##gedcom_setting`" .
+ " SET setting_value=?" .
+ " WHERE gedcom_id=? AND setting_name='MEDIA_DIRECTORY'"
+ )->execute([
+ $_media_dir,
+ $_cfg->gedcom_id,
+ ]);
+ }
+ } else {
+ // Not using the media firewall - just move the public folder to the new location (if we can).
+ if (
+ file_exists(WT_ROOT . $_cfg->media_directory) &&
+ is_dir(WT_ROOT . $_cfg->media_directory) &&
+ !file_exists($WT_DATA_DIR . $_cfg->media_directory)
+ ) {
+ try {
+ rename(WT_ROOT . $_cfg->media_directory, $WT_DATA_DIR . $_cfg->media_directory);
+ } catch (Throwable $ex) {
+ DebugBar::addThrowable($ex);
- // Cannot move the folder?
- }
- File::delete($WT_DATA_DIR . $_cfg->media_directory . '.htaccess');
- File::delete($WT_DATA_DIR . $_cfg->media_directory . 'index.php');
- File::delete($WT_DATA_DIR . $_cfg->media_directory . 'Mediainfo.txt');
- File::delete($WT_DATA_DIR . $_cfg->media_directory . 'thumbs/Thumbsinfo.txt');
- }
- }
- }
+ // Cannot move the folder?
+ }
+ File::delete($WT_DATA_DIR . $_cfg->media_directory . '.htaccess');
+ File::delete($WT_DATA_DIR . $_cfg->media_directory . 'index.php');
+ File::delete($WT_DATA_DIR . $_cfg->media_directory . 'Mediainfo.txt');
+ File::delete($WT_DATA_DIR . $_cfg->media_directory . 'thumbs/Thumbsinfo.txt');
+ }
+ }
+ }
- // Delete old settings
- Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('USE_MEDIA_FIREWALL', 'MEDIA_FIREWALL_THUMBS', 'MEDIA_FIREWALL_ROOTDIR')");
- }
+ // Delete old settings
+ Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('USE_MEDIA_FIREWALL', 'MEDIA_FIREWALL_THUMBS', 'MEDIA_FIREWALL_ROOTDIR')");
+ }
}
diff --git a/app/Schema/Migration23.php b/app/Schema/Migration23.php
index fd6b10240f..cfa51c8760 100644
--- a/app/Schema/Migration23.php
+++ b/app/Schema/Migration23.php
@@ -20,20 +20,22 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 23 to version 24.
*/
-class Migration23 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // - media table columns should be not null, so we can find
- // media objects with missing files
- Database::exec(
- "ALTER TABLE `##media`" .
- " CHANGE m_ext m_ext VARCHAR(6) COLLATE utf8_unicode_ci NOT NULL," .
- " CHANGE m_type m_type VARCHAR(20) COLLATE utf8_unicode_ci NOT NULL," .
- " CHANGE m_filename m_filename VARCHAR(512) COLLATE utf8_unicode_ci NOT NULL," .
- " CHANGE m_titl m_titl VARCHAR(255) COLLATE utf8_unicode_ci NOT NULL," .
- " CHANGE m_gedcom m_gedcom MEDIUMTEXT COLLATE utf8_unicode_ci NOT NULL"
- );
- }
+class Migration23 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // - media table columns should be not null, so we can find
+ // media objects with missing files
+ Database::exec(
+ "ALTER TABLE `##media`" .
+ " CHANGE m_ext m_ext VARCHAR(6) COLLATE utf8_unicode_ci NOT NULL," .
+ " CHANGE m_type m_type VARCHAR(20) COLLATE utf8_unicode_ci NOT NULL," .
+ " CHANGE m_filename m_filename VARCHAR(512) COLLATE utf8_unicode_ci NOT NULL," .
+ " CHANGE m_titl m_titl VARCHAR(255) COLLATE utf8_unicode_ci NOT NULL," .
+ " CHANGE m_gedcom m_gedcom MEDIUMTEXT COLLATE utf8_unicode_ci NOT NULL"
+ );
+ }
}
diff --git a/app/Schema/Migration24.php b/app/Schema/Migration24.php
index e0079a7f84..a40cfafeef 100644
--- a/app/Schema/Migration24.php
+++ b/app/Schema/Migration24.php
@@ -20,26 +20,28 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 24 to version 25.
*/
-class Migration24 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Tree settings become site settings
- Database::exec(
- "INSERT IGNORE INTO `##site_setting` (setting_name, setting_value)" .
- " SELECT setting_name, MIN(setting_value)" . // Can't use ANY_VALUE() until MySQL5.7
- " FROM `##gedcom_setting`" .
- " WHERE setting_name IN ('SHOW_REGISTER_CAUTION', 'WELCOME_TEXT_CUST_HEAD') OR setting_name LIKE 'WELCOME_TEXT_AUTH_MODE%'" .
- " GROUP BY setting_name"
- );
+class Migration24 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Tree settings become site settings
+ Database::exec(
+ "INSERT IGNORE INTO `##site_setting` (setting_name, setting_value)" .
+ " SELECT setting_name, MIN(setting_value)" . // Can't use ANY_VALUE() until MySQL5.7
+ " FROM `##gedcom_setting`" .
+ " WHERE setting_name IN ('SHOW_REGISTER_CAUTION', 'WELCOME_TEXT_CUST_HEAD') OR setting_name LIKE 'WELCOME_TEXT_AUTH_MODE%'" .
+ " GROUP BY setting_name"
+ );
- Database::exec(
- "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('ALLOW_EDIT_GEDCOM', 'SHOW_REGISTER_CAUTION', 'WELCOME_TEXT_CUST_HEAD') OR setting_name LIKE 'WELCOME_TEXT_AUTH_MODE%'"
- );
+ Database::exec(
+ "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('ALLOW_EDIT_GEDCOM', 'SHOW_REGISTER_CAUTION', 'WELCOME_TEXT_CUST_HEAD') OR setting_name LIKE 'WELCOME_TEXT_AUTH_MODE%'"
+ );
- Database::exec(
- "DELETE FROM `##site_setting` WHERE setting_name IN ('STORE_MESSAGES')"
- );
- }
+ Database::exec(
+ "DELETE FROM `##site_setting` WHERE setting_name IN ('STORE_MESSAGES')"
+ );
+ }
}
diff --git a/app/Schema/Migration25.php b/app/Schema/Migration25.php
index d02f4e72f8..fca0bcd05a 100644
--- a/app/Schema/Migration25.php
+++ b/app/Schema/Migration25.php
@@ -20,17 +20,19 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 25 to version 26.
*/
-class Migration25 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // - delete unused settings and update indexes
- Database::exec(
- "DELETE FROM `##site_setting` WHERE setting_name IN ('WELCOME_TEXT_CUST_HEAD')"
- );
+class Migration25 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // - delete unused settings and update indexes
+ Database::exec(
+ "DELETE FROM `##site_setting` WHERE setting_name IN ('WELCOME_TEXT_CUST_HEAD')"
+ );
- // Originally, this inserted entries into wt_site_access_rule,
- // however this table now gets deleted in Migration37.
- }
+ // Originally, this inserted entries into wt_site_access_rule,
+ // however this table now gets deleted in Migration37.
+ }
}
diff --git a/app/Schema/Migration26.php b/app/Schema/Migration26.php
index b00c725028..d27a428834 100644
--- a/app/Schema/Migration26.php
+++ b/app/Schema/Migration26.php
@@ -20,59 +20,61 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 26 to version 27.
*/
-class Migration26 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Earlier versions of webtrees put quote marks round soundex codes.
- // These are harmless, but clean them up for consistency.
- Database::exec(
- "UPDATE `##name` SET" .
- " n_soundex_givn_std = TRIM('''' FROM n_soundex_givn_std)," .
- " n_soundex_surn_std = TRIM('''' FROM n_soundex_surn_std)," .
- " n_soundex_givn_dm = TRIM('''' FROM n_soundex_givn_dm )," .
- " n_soundex_surn_dm = TRIM('''' FROM n_soundex_surn_dm )"
- );
+class Migration26 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Earlier versions of webtrees put quote marks round soundex codes.
+ // These are harmless, but clean them up for consistency.
+ Database::exec(
+ "UPDATE `##name` SET" .
+ " n_soundex_givn_std = TRIM('''' FROM n_soundex_givn_std)," .
+ " n_soundex_surn_std = TRIM('''' FROM n_soundex_surn_std)," .
+ " n_soundex_givn_dm = TRIM('''' FROM n_soundex_givn_dm )," .
+ " n_soundex_surn_dm = TRIM('''' FROM n_soundex_surn_dm )"
+ );
- // Earlier versions of webtrees added zero codes for names without phonetic content.
- // These are harmless, but clean them up for consistency.
- Database::exec(
- "UPDATE `##name` SET" .
- " n_soundex_givn_std = REPLACE(n_soundex_givn_std, '0000:', '')," .
- " n_soundex_surn_std = REPLACE(n_soundex_surn_std, '0000:', '')," .
- " n_soundex_givn_dm = REPLACE(n_soundex_givn_dm, '000000:', '')," .
- " n_soundex_surn_dm = REPLACE(n_soundex_surn_dm, '000000:', '')"
- );
- Database::exec(
- "UPDATE `##name` SET" .
- " n_soundex_givn_std = REPLACE(n_soundex_givn_std, ':0000', '')," .
- " n_soundex_surn_std = REPLACE(n_soundex_surn_std, ':0000', '')," .
- " n_soundex_givn_dm = REPLACE(n_soundex_givn_dm, ':000000', '')," .
- " n_soundex_surn_dm = REPLACE(n_soundex_surn_dm, ':000000', '')"
- );
- Database::exec(
- "UPDATE `##name` SET" .
- " n_soundex_givn_std = NULLIF(n_soundex_givn_std, '0000' )," .
- " n_soundex_surn_std = NULLIF(n_soundex_surn_std, '0000' )," .
- " n_soundex_givn_dm = NULLIF(n_soundex_givn_dm, '000000')," .
- " n_soundex_surn_dm = NULLIF(n_soundex_surn_dm, '000000')"
- );
+ // Earlier versions of webtrees added zero codes for names without phonetic content.
+ // These are harmless, but clean them up for consistency.
+ Database::exec(
+ "UPDATE `##name` SET" .
+ " n_soundex_givn_std = REPLACE(n_soundex_givn_std, '0000:', '')," .
+ " n_soundex_surn_std = REPLACE(n_soundex_surn_std, '0000:', '')," .
+ " n_soundex_givn_dm = REPLACE(n_soundex_givn_dm, '000000:', '')," .
+ " n_soundex_surn_dm = REPLACE(n_soundex_surn_dm, '000000:', '')"
+ );
+ Database::exec(
+ "UPDATE `##name` SET" .
+ " n_soundex_givn_std = REPLACE(n_soundex_givn_std, ':0000', '')," .
+ " n_soundex_surn_std = REPLACE(n_soundex_surn_std, ':0000', '')," .
+ " n_soundex_givn_dm = REPLACE(n_soundex_givn_dm, ':000000', '')," .
+ " n_soundex_surn_dm = REPLACE(n_soundex_surn_dm, ':000000', '')"
+ );
+ Database::exec(
+ "UPDATE `##name` SET" .
+ " n_soundex_givn_std = NULLIF(n_soundex_givn_std, '0000' )," .
+ " n_soundex_surn_std = NULLIF(n_soundex_surn_std, '0000' )," .
+ " n_soundex_givn_dm = NULLIF(n_soundex_givn_dm, '000000')," .
+ " n_soundex_surn_dm = NULLIF(n_soundex_surn_dm, '000000')"
+ );
- Database::exec(
- "UPDATE `##places` SET" .
- " p_std_soundex = REPLACE(p_std_soundex, '0000:', '')," .
- " p_dm_soundex = REPLACE(p_dm_soundex, '000000:', '')"
- );
- Database::exec(
- "UPDATE `##places` SET" .
- " p_std_soundex = REPLACE(p_std_soundex, ':0000', '')," .
- " p_dm_soundex = REPLACE(p_dm_soundex, ':000000', '')"
- );
- Database::exec(
- "UPDATE `##places` SET" .
- " p_std_soundex = NULLIF(p_std_soundex, '0000' )," .
- " p_dm_soundex = NULLIF(p_dm_soundex, '000000')"
- );
- }
+ Database::exec(
+ "UPDATE `##places` SET" .
+ " p_std_soundex = REPLACE(p_std_soundex, '0000:', '')," .
+ " p_dm_soundex = REPLACE(p_dm_soundex, '000000:', '')"
+ );
+ Database::exec(
+ "UPDATE `##places` SET" .
+ " p_std_soundex = REPLACE(p_std_soundex, ':0000', '')," .
+ " p_dm_soundex = REPLACE(p_dm_soundex, ':000000', '')"
+ );
+ Database::exec(
+ "UPDATE `##places` SET" .
+ " p_std_soundex = NULLIF(p_std_soundex, '0000' )," .
+ " p_dm_soundex = NULLIF(p_dm_soundex, '000000')"
+ );
+ }
}
diff --git a/app/Schema/Migration27.php b/app/Schema/Migration27.php
index 3f79cdab52..b50257175f 100644
--- a/app/Schema/Migration27.php
+++ b/app/Schema/Migration27.php
@@ -20,17 +20,19 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 27 to version 28.
*/
-class Migration27 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Delete old/unused settings
- Database::exec(
- "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('USE_GEONAMES')"
- );
+class Migration27 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Delete old/unused settings
+ Database::exec(
+ "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('USE_GEONAMES')"
+ );
- // Originally, this updated wt_site_access_rule,
- // however this table now gets deleted in Migration37.
- }
+ // Originally, this updated wt_site_access_rule,
+ // however this table now gets deleted in Migration37.
+ }
}
diff --git a/app/Schema/Migration28.php b/app/Schema/Migration28.php
index 1d8dbd45f0..89b73ccc72 100644
--- a/app/Schema/Migration28.php
+++ b/app/Schema/Migration28.php
@@ -20,14 +20,16 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 28 to version 29.
*/
-class Migration28 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Earlier versions used the wrong month number for Adar in non-leap years
- Database::exec(
- "UPDATE `##dates` SET d_mon = 7 WHERE d_mon = 6 && d_type = '@#DHEBREW@' AND MOD(7 * d_year + 1, 19) >= 7"
- );
- }
+class Migration28 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Earlier versions used the wrong month number for Adar in non-leap years
+ Database::exec(
+ "UPDATE `##dates` SET d_mon = 7 WHERE d_mon = 6 && d_type = '@#DHEBREW@' AND MOD(7 * d_year + 1, 19) >= 7"
+ );
+ }
}
diff --git a/app/Schema/Migration29.php b/app/Schema/Migration29.php
index 47a467f93b..0bbdef5063 100644
--- a/app/Schema/Migration29.php
+++ b/app/Schema/Migration29.php
@@ -20,48 +20,50 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 29 to version 30.
*/
-class Migration29 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Originally migrated from PhpGedView, but never used.
- Database::exec("DROP TABLE IF EXISTS `##ip_address`");
+class Migration29 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Originally migrated from PhpGedView, but never used.
+ Database::exec("DROP TABLE IF EXISTS `##ip_address`");
- // No longer used
- Database::exec("DELETE FROM `##user_setting` WHERE setting_name IN ('editaccount')");
- Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('SHOW_STATS')");
- Database::exec("DELETE FROM `##site_setting` WHERE setting_name IN ('REQUIRE_ADMIN_AUTH_REGISTRATION')");
+ // No longer used
+ Database::exec("DELETE FROM `##user_setting` WHERE setting_name IN ('editaccount')");
+ Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('SHOW_STATS')");
+ Database::exec("DELETE FROM `##site_setting` WHERE setting_name IN ('REQUIRE_ADMIN_AUTH_REGISTRATION')");
- // Originally, this updated entries into wt_site_access_rule,
- // however this table now gets deleted in Migration37.
+ // Originally, this updated entries into wt_site_access_rule,
+ // however this table now gets deleted in Migration37.
- // Embedded variables are based on function names - which were renamed for PSR2
- Database::exec(
- "UPDATE `##block_setting` " .
- " JOIN `##block` USING (block_id)" .
- " SET setting_value = REPLACE(setting_value, '#WT_VERSION#', '#webtreesVersion#')" .
- " WHERE setting_name = 'html' AND module_name = 'html'"
- );
- Database::exec(
- "UPDATE `##block_setting` " .
- " JOIN `##block` USING (block_id)" .
- " SET setting_value = REPLACE(setting_value, '#browserTime24#', '#browserTime#')" .
- " WHERE setting_name = 'html' AND module_name = 'html'"
- );
+ // Embedded variables are based on function names - which were renamed for PSR2
+ Database::exec(
+ "UPDATE `##block_setting` " .
+ " JOIN `##block` USING (block_id)" .
+ " SET setting_value = REPLACE(setting_value, '#WT_VERSION#', '#webtreesVersion#')" .
+ " WHERE setting_name = 'html' AND module_name = 'html'"
+ );
+ Database::exec(
+ "UPDATE `##block_setting` " .
+ " JOIN `##block` USING (block_id)" .
+ " SET setting_value = REPLACE(setting_value, '#browserTime24#', '#browserTime#')" .
+ " WHERE setting_name = 'html' AND module_name = 'html'"
+ );
- // Language settings have changed from locale (en_GB) to language tag (en-GB)
- Database::exec(
- "UPDATE `##gedcom_setting` SET setting_value = REPLACE(setting_value, '_', '-') WHERE setting_name = 'language'"
- );
- Database::exec(
- "UPDATE `##site_setting` SET setting_value = REPLACE(setting_value, '_', '-') WHERE setting_name = 'language'"
- );
- Database::exec(
- "UPDATE `##user_setting` SET setting_value = REPLACE(setting_value, '_', '-') WHERE setting_name = 'language'"
- );
- Database::exec(
- "UPDATE `##block_setting` SET setting_value = REPLACE(setting_value, '_', '-') WHERE setting_name = 'languages'"
- );
- }
+ // Language settings have changed from locale (en_GB) to language tag (en-GB)
+ Database::exec(
+ "UPDATE `##gedcom_setting` SET setting_value = REPLACE(setting_value, '_', '-') WHERE setting_name = 'language'"
+ );
+ Database::exec(
+ "UPDATE `##site_setting` SET setting_value = REPLACE(setting_value, '_', '-') WHERE setting_name = 'language'"
+ );
+ Database::exec(
+ "UPDATE `##user_setting` SET setting_value = REPLACE(setting_value, '_', '-') WHERE setting_name = 'language'"
+ );
+ Database::exec(
+ "UPDATE `##block_setting` SET setting_value = REPLACE(setting_value, '_', '-') WHERE setting_name = 'languages'"
+ );
+ }
}
diff --git a/app/Schema/Migration3.php b/app/Schema/Migration3.php
index 3b79901557..57b0bfe1bd 100644
--- a/app/Schema/Migration3.php
+++ b/app/Schema/Migration3.php
@@ -20,42 +20,44 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 3 to version 4.
*/
-class Migration3 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Update the max_relation_path_length from a separate
- // user setting and gedcom setting to a combined user-gedcom
- // setting.
- // Also clean out some old/unused values.
+class Migration3 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Update the max_relation_path_length from a separate
+ // user setting and gedcom setting to a combined user-gedcom
+ // setting.
+ // Also clean out some old/unused values.
- Database::exec(
- "INSERT IGNORE INTO `##user_gedcom_setting` (user_id, gedcom_id, setting_name, setting_value)" .
- " SELECT u.user_id, g.gedcom_id, 'RELATIONSHIP_PATH_LENGTH', LEAST(us1.setting_value, gs1.setting_value)" .
- " FROM `##user` u" .
- " CROSS JOIN `##gedcom` g" .
- " LEFT JOIN `##user_setting` us1 ON (u.user_id =us1.user_id AND us1.setting_name='max_relation_path')" .
- " LEFT JOIN `##user_setting` us2 ON (u.user_id =us2.user_id AND us2.setting_name='relationship_privacy')" .
- " LEFT JOIN `##gedcom_setting` gs1 ON (g.gedcom_id=gs1.gedcom_id AND gs1.setting_name='MAX_RELATION_PATH_LENGTH')" .
- " LEFT JOIN `##gedcom_setting` gs2 ON (g.gedcom_id=gs2.gedcom_id AND gs2.setting_name='USE_RELATIONSHIP_PRIVACY')" .
- " WHERE us2.setting_value AND gs2.setting_value"
- );
+ Database::exec(
+ "INSERT IGNORE INTO `##user_gedcom_setting` (user_id, gedcom_id, setting_name, setting_value)" .
+ " SELECT u.user_id, g.gedcom_id, 'RELATIONSHIP_PATH_LENGTH', LEAST(us1.setting_value, gs1.setting_value)" .
+ " FROM `##user` u" .
+ " CROSS JOIN `##gedcom` g" .
+ " LEFT JOIN `##user_setting` us1 ON (u.user_id =us1.user_id AND us1.setting_name='max_relation_path')" .
+ " LEFT JOIN `##user_setting` us2 ON (u.user_id =us2.user_id AND us2.setting_name='relationship_privacy')" .
+ " LEFT JOIN `##gedcom_setting` gs1 ON (g.gedcom_id=gs1.gedcom_id AND gs1.setting_name='MAX_RELATION_PATH_LENGTH')" .
+ " LEFT JOIN `##gedcom_setting` gs2 ON (g.gedcom_id=gs2.gedcom_id AND gs2.setting_name='USE_RELATIONSHIP_PRIVACY')" .
+ " WHERE us2.setting_value AND gs2.setting_value"
+ );
- // Delete old/unused settings
- Database::exec(
- "DELETE FROM `##site_setting` WHERE setting_name IN ('SESSION_SAVE_PATH')"
- );
- Database::exec(
- "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('HOME_SITE_TEXT', 'HOME_SITE_URL', 'CHECK_MARRIAGE_RELATIONS', 'MAX_RELATION_PATH_LENGTH', 'USE_RELATIONSHIP_PRIVACY')"
- );
- Database::exec(
- "DELETE FROM `##user_setting` WHERE setting_name IN ('loggedin', 'relationship_privacy', 'max_relation_path_length')"
- );
+ // Delete old/unused settings
+ Database::exec(
+ "DELETE FROM `##site_setting` WHERE setting_name IN ('SESSION_SAVE_PATH')"
+ );
+ Database::exec(
+ "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('HOME_SITE_TEXT', 'HOME_SITE_URL', 'CHECK_MARRIAGE_RELATIONS', 'MAX_RELATION_PATH_LENGTH', 'USE_RELATIONSHIP_PRIVACY')"
+ );
+ Database::exec(
+ "DELETE FROM `##user_setting` WHERE setting_name IN ('loggedin', 'relationship_privacy', 'max_relation_path_length')"
+ );
- // Fix Mc/Mac problems - See SVN9701
- Database::exec(
- "UPDATE `##name` SET n_surn=CONCAT('MC', SUBSTRING(n_surn, 4)) WHERE n_surn LIKE 'MC0%'"
- );
- }
+ // Fix Mc/Mac problems - See SVN9701
+ Database::exec(
+ "UPDATE `##name` SET n_surn=CONCAT('MC', SUBSTRING(n_surn, 4)) WHERE n_surn LIKE 'MC0%'"
+ );
+ }
}
diff --git a/app/Schema/Migration30.php b/app/Schema/Migration30.php
index 17c73de749..78287ec0e1 100644
--- a/app/Schema/Migration30.php
+++ b/app/Schema/Migration30.php
@@ -22,131 +22,133 @@ use Fisharebest\Webtrees\Filter;
/**
* Upgrade the database schema from version 30 to version 31.
*/
-class Migration30 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- $WEBTREES_EMAIL = 'webtrees-noreply@' . preg_replace('/^www\./i', '', Filter::server('SERVER_NAME'));
+class Migration30 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ $WEBTREES_EMAIL = 'webtrees-noreply@' . preg_replace('/^www\./i', '', Filter::server('SERVER_NAME'));
- // Default settings for new trees. No defaults for:
- // imported, title, CONTACT_USER_ID, WEBMASTER_USER_ID
- // The following settings have defaults, but may need overwriting:
- // LANGUAGE, SURNAME_TRADITION
- Database::prepare(
- "INSERT IGNORE INTO `##gedcom_setting` (gedcom_id, setting_name, setting_value) VALUES" .
- "(-1, 'ADVANCED_NAME_FACTS', 'NICK,_AKA')," .
- "(-1, 'ADVANCED_PLAC_FACTS', '')," .
- "(-1, 'ALLOW_THEME_DROPDOWN', '1')," .
- "(-1, 'CALENDAR_FORMAT', 'gregorian')," .
- "(-1, 'CHART_BOX_TAGS', '')," .
- "(-1, 'COMMON_NAMES_ADD', '')," .
- "(-1, 'COMMON_NAMES_REMOVE', '')," .
- "(-1, 'COMMON_NAMES_THRESHOLD', '40')," .
- "(-1, 'DEFAULT_PEDIGREE_GENERATIONS', '4')," .
- "(-1, 'EXPAND_RELATIVES_EVENTS', '0')," .
- "(-1, 'EXPAND_SOURCES', '0')," .
- "(-1, 'FAM_FACTS_ADD', 'CENS,MARR,RESI,SLGS,MARR_CIVIL,MARR_RELIGIOUS,MARR_PARTNERS,RESN')," .
- "(-1, 'FAM_FACTS_QUICK', 'MARR,DIV,_NMR')," .
- "(-1, 'FAM_FACTS_UNIQUE', 'NCHI,MARL,DIV,ANUL,DIVF,ENGA,MARB,MARC,MARS,_NMR')," .
- "(-1, 'FAM_ID_PREFIX', 'F')," .
- "(-1, 'FORMAT_TEXT', 'markdown')," .
- "(-1, 'FULL_SOURCES', '0')," .
- "(-1, 'GEDCOM_ID_PREFIX', 'I')," .
- "(-1, 'GEDCOM_MEDIA_PATH', '')," .
- "(-1, 'GENERATE_UIDS', '0')," .
- "(-1, 'HIDE_GEDCOM_ERRORS', '1')," .
- "(-1, 'HIDE_LIVE_PEOPLE', '1')," .
- "(-1, 'INDI_FACTS_ADD', 'AFN,BIRT,DEAT,BURI,CREM,ADOP,BAPM,BARM,BASM,BLES,CHRA,CONF,FCOM,ORDN,NATU,EMIG,IMMI,CENS,PROB,WILL,GRAD,RETI,DSCR,EDUC,IDNO,NATI,NCHI,NMR,OCCU,PROP,RELI,RESI,SSN,TITL,BAPL,CONL,ENDL,SLGC,_MILI,ASSO,RESN')," .
- "(-1, 'INDI_FACTS_QUICK', 'BIRT,BURI,BAPM,CENS,DEAT,OCCU,RESI')," .
- "(-1, 'INDI_FACTS_UNIQUE', '')," .
- "(-1, 'KEEP_ALIVE_YEARS_BIRTH', '')," .
- "(-1, 'KEEP_ALIVE_YEARS_DEATH', '')," .
- "(-1, 'LANGUAGE', 'en-US')," .
- "(-1, 'MAX_ALIVE_AGE', '120')," .
- "(-1, 'MAX_DESCENDANCY_GENERATIONS', '15')," .
- "(-1, 'MAX_PEDIGREE_GENERATIONS', '10')," .
- "(-1, 'MEDIA_DIRECTORY', 'media/')," .
- "(-1, 'MEDIA_ID_PREFIX', 'M')," .
- "(-1, 'MEDIA_UPLOAD', :MEDIA_UPLOAD)," .
- "(-1, 'META_DESCRIPTION', '')," .
- "(-1, 'META_TITLE', :META_TITLE)," .
- "(-1, 'NOTE_FACTS_ADD', 'SOUR,RESN')," .
- "(-1, 'NOTE_FACTS_QUICK', '')," .
- "(-1, 'NOTE_FACTS_UNIQUE', '')," .
- "(-1, 'NOTE_ID_PREFIX', 'N')," .
- "(-1, 'NO_UPDATE_CHAN', '0')," .
- "(-1, 'PEDIGREE_LAYOUT', '1')," .
- "(-1, 'PEDIGREE_ROOT_ID', '')," .
- "(-1, 'PEDIGREE_SHOW_GENDER', '0')," .
- "(-1, 'PREFER_LEVEL2_SOURCES', '1')," .
- "(-1, 'QUICK_REQUIRED_FACTS', 'BIRT,DEAT')," .
- "(-1, 'QUICK_REQUIRED_FAMFACTS', 'MARR')," .
- "(-1, 'REPO_FACTS_ADD', 'PHON,EMAIL,FAX,WWW,RESN')," .
- "(-1, 'REPO_FACTS_QUICK', '')," .
- "(-1, 'REPO_FACTS_UNIQUE', 'NAME,ADDR')," .
- "(-1, 'REPO_ID_PREFIX', 'R')," .
- "(-1, 'REQUIRE_AUTHENTICATION', '0')," .
- "(-1, 'SAVE_WATERMARK_IMAGE', '0')," .
- "(-1, 'SHOW_AGE_DIFF', '0')," .
- "(-1, 'SHOW_COUNTER', '1')," .
- "(-1, 'SHOW_DEAD_PEOPLE', :SHOW_DEAD_PEOPLE)," .
- "(-1, 'SHOW_EST_LIST_DATES', '0')," .
- "(-1, 'SHOW_FACT_ICONS', '1')," .
- "(-1, 'SHOW_GEDCOM_RECORD', '0')," .
- "(-1, 'SHOW_HIGHLIGHT_IMAGES', '1')," .
- "(-1, 'SHOW_LDS_AT_GLANCE', '0')," .
- "(-1, 'SHOW_LEVEL2_NOTES', '1')," .
- "(-1, 'SHOW_LIVING_NAMES', :SHOW_LIVING_NAMES)," .
- "(-1, 'SHOW_MEDIA_DOWNLOAD', '0')," .
- "(-1, 'SHOW_NO_WATERMARK', :SHOW_NO_WATERMARK)," .
- "(-1, 'SHOW_PARENTS_AGE', '1')," .
- "(-1, 'SHOW_PEDIGREE_PLACES', '9')," .
- "(-1, 'SHOW_PEDIGREE_PLACES_SUFFIX', '0')," .
- "(-1, 'SHOW_PRIVATE_RELATIONSHIPS', '1')," .
- "(-1, 'SHOW_RELATIVES_EVENTS', '_BIRT_CHIL,_BIRT_SIBL,_MARR_CHIL,_MARR_PARE,_DEAT_CHIL,_DEAT_PARE,_DEAT_GPAR,_DEAT_SIBL,_DEAT_SPOU')," .
- "(-1, 'SOURCE_ID_PREFIX', 'S')," .
- "(-1, 'SOUR_FACTS_ADD', 'NOTE,REPO,SHARED_NOTE,RESN')," .
- "(-1, 'SOUR_FACTS_QUICK', 'TEXT,NOTE,REPO')," .
- "(-1, 'SOUR_FACTS_UNIQUE', 'AUTH,ABBR,TITL,PUBL,TEXT')," .
- "(-1, 'SUBLIST_TRIGGER_I', '200')," .
- "(-1, 'SURNAME_LIST_STYLE', 'style2')," .
- "(-1, 'SURNAME_TRADITION', 'paternal')," .
- "(-1, 'THUMBNAIL_WIDTH', '100')," .
- "(-1, 'USE_RIN', '0')," .
- "(-1, 'USE_SILHOUETTE', '1')," .
- "(-1, 'WEBTREES_EMAIL', :WEBTREES_EMAIL)," .
- "(-1, 'WORD_WRAPPED_NOTES', '0')"
- )->execute([
- 'MEDIA_UPLOAD' => Auth::PRIV_USER,
- 'META_TITLE' => WT_WEBTREES,
- 'SHOW_DEAD_PEOPLE' => Auth::PRIV_PRIVATE,
- 'SHOW_LIVING_NAMES' => Auth::PRIV_USER,
- 'SHOW_NO_WATERMARK' => Auth::PRIV_USER,
- 'WEBTREES_EMAIL' => $WEBTREES_EMAIL,
- ]);
+ // Default settings for new trees. No defaults for:
+ // imported, title, CONTACT_USER_ID, WEBMASTER_USER_ID
+ // The following settings have defaults, but may need overwriting:
+ // LANGUAGE, SURNAME_TRADITION
+ Database::prepare(
+ "INSERT IGNORE INTO `##gedcom_setting` (gedcom_id, setting_name, setting_value) VALUES" .
+ "(-1, 'ADVANCED_NAME_FACTS', 'NICK,_AKA')," .
+ "(-1, 'ADVANCED_PLAC_FACTS', '')," .
+ "(-1, 'ALLOW_THEME_DROPDOWN', '1')," .
+ "(-1, 'CALENDAR_FORMAT', 'gregorian')," .
+ "(-1, 'CHART_BOX_TAGS', '')," .
+ "(-1, 'COMMON_NAMES_ADD', '')," .
+ "(-1, 'COMMON_NAMES_REMOVE', '')," .
+ "(-1, 'COMMON_NAMES_THRESHOLD', '40')," .
+ "(-1, 'DEFAULT_PEDIGREE_GENERATIONS', '4')," .
+ "(-1, 'EXPAND_RELATIVES_EVENTS', '0')," .
+ "(-1, 'EXPAND_SOURCES', '0')," .
+ "(-1, 'FAM_FACTS_ADD', 'CENS,MARR,RESI,SLGS,MARR_CIVIL,MARR_RELIGIOUS,MARR_PARTNERS,RESN')," .
+ "(-1, 'FAM_FACTS_QUICK', 'MARR,DIV,_NMR')," .
+ "(-1, 'FAM_FACTS_UNIQUE', 'NCHI,MARL,DIV,ANUL,DIVF,ENGA,MARB,MARC,MARS,_NMR')," .
+ "(-1, 'FAM_ID_PREFIX', 'F')," .
+ "(-1, 'FORMAT_TEXT', 'markdown')," .
+ "(-1, 'FULL_SOURCES', '0')," .
+ "(-1, 'GEDCOM_ID_PREFIX', 'I')," .
+ "(-1, 'GEDCOM_MEDIA_PATH', '')," .
+ "(-1, 'GENERATE_UIDS', '0')," .
+ "(-1, 'HIDE_GEDCOM_ERRORS', '1')," .
+ "(-1, 'HIDE_LIVE_PEOPLE', '1')," .
+ "(-1, 'INDI_FACTS_ADD', 'AFN,BIRT,DEAT,BURI,CREM,ADOP,BAPM,BARM,BASM,BLES,CHRA,CONF,FCOM,ORDN,NATU,EMIG,IMMI,CENS,PROB,WILL,GRAD,RETI,DSCR,EDUC,IDNO,NATI,NCHI,NMR,OCCU,PROP,RELI,RESI,SSN,TITL,BAPL,CONL,ENDL,SLGC,_MILI,ASSO,RESN')," .
+ "(-1, 'INDI_FACTS_QUICK', 'BIRT,BURI,BAPM,CENS,DEAT,OCCU,RESI')," .
+ "(-1, 'INDI_FACTS_UNIQUE', '')," .
+ "(-1, 'KEEP_ALIVE_YEARS_BIRTH', '')," .
+ "(-1, 'KEEP_ALIVE_YEARS_DEATH', '')," .
+ "(-1, 'LANGUAGE', 'en-US')," .
+ "(-1, 'MAX_ALIVE_AGE', '120')," .
+ "(-1, 'MAX_DESCENDANCY_GENERATIONS', '15')," .
+ "(-1, 'MAX_PEDIGREE_GENERATIONS', '10')," .
+ "(-1, 'MEDIA_DIRECTORY', 'media/')," .
+ "(-1, 'MEDIA_ID_PREFIX', 'M')," .
+ "(-1, 'MEDIA_UPLOAD', :MEDIA_UPLOAD)," .
+ "(-1, 'META_DESCRIPTION', '')," .
+ "(-1, 'META_TITLE', :META_TITLE)," .
+ "(-1, 'NOTE_FACTS_ADD', 'SOUR,RESN')," .
+ "(-1, 'NOTE_FACTS_QUICK', '')," .
+ "(-1, 'NOTE_FACTS_UNIQUE', '')," .
+ "(-1, 'NOTE_ID_PREFIX', 'N')," .
+ "(-1, 'NO_UPDATE_CHAN', '0')," .
+ "(-1, 'PEDIGREE_LAYOUT', '1')," .
+ "(-1, 'PEDIGREE_ROOT_ID', '')," .
+ "(-1, 'PEDIGREE_SHOW_GENDER', '0')," .
+ "(-1, 'PREFER_LEVEL2_SOURCES', '1')," .
+ "(-1, 'QUICK_REQUIRED_FACTS', 'BIRT,DEAT')," .
+ "(-1, 'QUICK_REQUIRED_FAMFACTS', 'MARR')," .
+ "(-1, 'REPO_FACTS_ADD', 'PHON,EMAIL,FAX,WWW,RESN')," .
+ "(-1, 'REPO_FACTS_QUICK', '')," .
+ "(-1, 'REPO_FACTS_UNIQUE', 'NAME,ADDR')," .
+ "(-1, 'REPO_ID_PREFIX', 'R')," .
+ "(-1, 'REQUIRE_AUTHENTICATION', '0')," .
+ "(-1, 'SAVE_WATERMARK_IMAGE', '0')," .
+ "(-1, 'SHOW_AGE_DIFF', '0')," .
+ "(-1, 'SHOW_COUNTER', '1')," .
+ "(-1, 'SHOW_DEAD_PEOPLE', :SHOW_DEAD_PEOPLE)," .
+ "(-1, 'SHOW_EST_LIST_DATES', '0')," .
+ "(-1, 'SHOW_FACT_ICONS', '1')," .
+ "(-1, 'SHOW_GEDCOM_RECORD', '0')," .
+ "(-1, 'SHOW_HIGHLIGHT_IMAGES', '1')," .
+ "(-1, 'SHOW_LDS_AT_GLANCE', '0')," .
+ "(-1, 'SHOW_LEVEL2_NOTES', '1')," .
+ "(-1, 'SHOW_LIVING_NAMES', :SHOW_LIVING_NAMES)," .
+ "(-1, 'SHOW_MEDIA_DOWNLOAD', '0')," .
+ "(-1, 'SHOW_NO_WATERMARK', :SHOW_NO_WATERMARK)," .
+ "(-1, 'SHOW_PARENTS_AGE', '1')," .
+ "(-1, 'SHOW_PEDIGREE_PLACES', '9')," .
+ "(-1, 'SHOW_PEDIGREE_PLACES_SUFFIX', '0')," .
+ "(-1, 'SHOW_PRIVATE_RELATIONSHIPS', '1')," .
+ "(-1, 'SHOW_RELATIVES_EVENTS', '_BIRT_CHIL,_BIRT_SIBL,_MARR_CHIL,_MARR_PARE,_DEAT_CHIL,_DEAT_PARE,_DEAT_GPAR,_DEAT_SIBL,_DEAT_SPOU')," .
+ "(-1, 'SOURCE_ID_PREFIX', 'S')," .
+ "(-1, 'SOUR_FACTS_ADD', 'NOTE,REPO,SHARED_NOTE,RESN')," .
+ "(-1, 'SOUR_FACTS_QUICK', 'TEXT,NOTE,REPO')," .
+ "(-1, 'SOUR_FACTS_UNIQUE', 'AUTH,ABBR,TITL,PUBL,TEXT')," .
+ "(-1, 'SUBLIST_TRIGGER_I', '200')," .
+ "(-1, 'SURNAME_LIST_STYLE', 'style2')," .
+ "(-1, 'SURNAME_TRADITION', 'paternal')," .
+ "(-1, 'THUMBNAIL_WIDTH', '100')," .
+ "(-1, 'USE_RIN', '0')," .
+ "(-1, 'USE_SILHOUETTE', '1')," .
+ "(-1, 'WEBTREES_EMAIL', :WEBTREES_EMAIL)," .
+ "(-1, 'WORD_WRAPPED_NOTES', '0')"
+ )->execute([
+ 'MEDIA_UPLOAD' => Auth::PRIV_USER,
+ 'META_TITLE' => WT_WEBTREES,
+ 'SHOW_DEAD_PEOPLE' => Auth::PRIV_PRIVATE,
+ 'SHOW_LIVING_NAMES' => Auth::PRIV_USER,
+ 'SHOW_NO_WATERMARK' => Auth::PRIV_USER,
+ 'WEBTREES_EMAIL' => $WEBTREES_EMAIL,
+ ]);
- // Previous versions of webtrees allowed this setting to be empty.
- Database::prepare(
- "DELETE FROM `##gedcom_setting` WHERE setting_name ='WEBTREES_EMAIL' AND setting_value = ''"
- )->execute();
+ // Previous versions of webtrees allowed this setting to be empty.
+ Database::prepare(
+ "DELETE FROM `##gedcom_setting` WHERE setting_name ='WEBTREES_EMAIL' AND setting_value = ''"
+ )->execute();
- Database::prepare(
- "INSERT IGNORE INTO `##gedcom_setting` (gedcom_id, setting_name, setting_value)" .
- " SELECT gedcom_id, 'WEBTREES_EMAIL', :WEBTREES_EMAIL" .
- " FROM `##gedcom` WHERE gedcom_id > 0"
- )->execute([
- 'WEBTREES_EMAIL' => $WEBTREES_EMAIL,
- ]);
+ Database::prepare(
+ "INSERT IGNORE INTO `##gedcom_setting` (gedcom_id, setting_name, setting_value)" .
+ " SELECT gedcom_id, 'WEBTREES_EMAIL', :WEBTREES_EMAIL" .
+ " FROM `##gedcom` WHERE gedcom_id > 0"
+ )->execute([
+ 'WEBTREES_EMAIL' => $WEBTREES_EMAIL,
+ ]);
- // Default restrictions
- Database::prepare(
- "INSERT IGNORE INTO `##default_resn` (gedcom_id, tag_type, resn) VALUES " .
- "(-1, 'SSN', 'confidential')," .
- "(-1, 'SOUR', 'privacy')," .
- "(-1, 'REPO', 'privacy')," .
- "(-1, 'SUBM', 'confidential')," .
- "(-1, 'SUBN', 'confidential')"
- )->execute();
- }
+ // Default restrictions
+ Database::prepare(
+ "INSERT IGNORE INTO `##default_resn` (gedcom_id, tag_type, resn) VALUES " .
+ "(-1, 'SSN', 'confidential')," .
+ "(-1, 'SOUR', 'privacy')," .
+ "(-1, 'REPO', 'privacy')," .
+ "(-1, 'SUBM', 'confidential')," .
+ "(-1, 'SUBN', 'confidential')"
+ )->execute();
+ }
}
diff --git a/app/Schema/Migration31.php b/app/Schema/Migration31.php
index 5c5d63aa67..bae1beb809 100644
--- a/app/Schema/Migration31.php
+++ b/app/Schema/Migration31.php
@@ -23,63 +23,65 @@ use PDOException;
/**
* Upgrade the database schema from version 31 to version 32.
*/
-class Migration31 implements MigrationInterface {
- /** @var string[] Updated language codes */
- private $languages = [
- 'en_AU' => 'en-AU',
- 'en_GB' => 'en-GB',
- 'en_US' => 'en-US',
- 'fr_CA' => 'fr-CA',
- 'pt_BR' => 'pt-BR',
- ];
+class Migration31 implements MigrationInterface
+{
+ /** @var string[] Updated language codes */
+ private $languages = [
+ 'en_AU' => 'en-AU',
+ 'en_GB' => 'en-GB',
+ 'en_US' => 'en-US',
+ 'fr_CA' => 'fr-CA',
+ 'pt_BR' => 'pt-BR',
+ ];
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- $index_dir = Site::getPreference('INDEX_DIRECTORY');
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ $index_dir = Site::getPreference('INDEX_DIRECTORY');
- // Due to the language code changes in 1.7.0, we need to update some other settings
- foreach ($this->languages as $old => $new) {
- try {
- Database::prepare(
- "UPDATE `##site_setting` SET setting_name = REPLACE(setting_name, :old, :new) " .
- "WHERE setting_name LIKE 'WELCOME_TEXT_AUTH_MODE_%'"
- )->execute([
- 'old' => $old,
- 'new' => $new,
- ]);
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+ // Due to the language code changes in 1.7.0, we need to update some other settings
+ foreach ($this->languages as $old => $new) {
+ try {
+ Database::prepare(
+ "UPDATE `##site_setting` SET setting_name = REPLACE(setting_name, :old, :new) " .
+ "WHERE setting_name LIKE 'WELCOME_TEXT_AUTH_MODE_%'"
+ )->execute([
+ 'old' => $old,
+ 'new' => $new,
+ ]);
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Duplicate key? Already done?
- }
+ // Duplicate key? Already done?
+ }
- Database::prepare(
- "UPDATE `##block_setting` SET setting_value = REPLACE(setting_value, :old, :new) " .
- "WHERE setting_name = 'languages'"
- )->execute([
- 'old' => $old,
- 'new' => $new,
- ]);
+ Database::prepare(
+ "UPDATE `##block_setting` SET setting_value = REPLACE(setting_value, :old, :new) " .
+ "WHERE setting_name = 'languages'"
+ )->execute([
+ 'old' => $old,
+ 'new' => $new,
+ ]);
- // Historical fact files
- if (file_exists($index_dir . 'histo.' . $old . '.php') && !file_exists($index_dir . 'histo.' . $new . '.php')) {
- rename($index_dir . 'histo.' . $old . '.php', $index_dir . 'histo.' . $new . '.php');
- }
+ // Historical fact files
+ if (file_exists($index_dir . 'histo.' . $old . '.php') && !file_exists($index_dir . 'histo.' . $new . '.php')) {
+ rename($index_dir . 'histo.' . $old . '.php', $index_dir . 'histo.' . $new . '.php');
+ }
- // Language files
- if (file_exists($index_dir . 'language/' . $old . '.php') && !file_exists($index_dir . 'language/' . $new . '.php')) {
- rename($index_dir . 'language/' . $old . '.php', $index_dir . 'language/' . $new . '.php');
- }
+ // Language files
+ if (file_exists($index_dir . 'language/' . $old . '.php') && !file_exists($index_dir . 'language/' . $new . '.php')) {
+ rename($index_dir . 'language/' . $old . '.php', $index_dir . 'language/' . $new . '.php');
+ }
- if (file_exists($index_dir . 'language/' . $old . '.csv') && !file_exists($index_dir . 'language/' . $new . '.csv')) {
- rename($index_dir . 'language/' . $old . '.csv', $index_dir . 'language/' . $new . '.csv');
- }
+ if (file_exists($index_dir . 'language/' . $old . '.csv') && !file_exists($index_dir . 'language/' . $new . '.csv')) {
+ rename($index_dir . 'language/' . $old . '.csv', $index_dir . 'language/' . $new . '.csv');
+ }
- if (file_exists($index_dir . 'language/' . $old . '.mo') && !file_exists($index_dir . 'language/' . $new . '.mo')) {
- rename($index_dir . 'language/' . $old . '.mo', $index_dir . 'language/' . $new . '.mo');
- }
- }
- }
+ if (file_exists($index_dir . 'language/' . $old . '.mo') && !file_exists($index_dir . 'language/' . $new . '.mo')) {
+ rename($index_dir . 'language/' . $old . '.mo', $index_dir . 'language/' . $new . '.mo');
+ }
+ }
+ }
}
diff --git a/app/Schema/Migration32.php b/app/Schema/Migration32.php
index 163360b127..15d4488449 100644
--- a/app/Schema/Migration32.php
+++ b/app/Schema/Migration32.php
@@ -22,23 +22,25 @@ use PDOException;
/**
* Upgrade the database schema from version 32 to version 33.
*/
-class Migration32 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- try {
- Database::prepare(
- "ALTER TABLE `##site_setting` CHANGE setting_value setting_value VARCHAR(2000) NOT NULL"
- )->execute();
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+class Migration32 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ try {
+ Database::prepare(
+ "ALTER TABLE `##site_setting` CHANGE setting_value setting_value VARCHAR(2000) NOT NULL"
+ )->execute();
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Already done?
- }
+ // Already done?
+ }
- Database::prepare(
- "DELETE FROM `##change` WHERE old_gedcom = '' AND new_gedcom = ''"
- )->execute();
- }
+ Database::prepare(
+ "DELETE FROM `##change` WHERE old_gedcom = '' AND new_gedcom = ''"
+ )->execute();
+ }
}
diff --git a/app/Schema/Migration33.php b/app/Schema/Migration33.php
index 0564ff21f0..6916218c10 100644
--- a/app/Schema/Migration33.php
+++ b/app/Schema/Migration33.php
@@ -18,12 +18,14 @@ namespace Fisharebest\Webtrees\Schema;
/**
* Upgrade the database schema from version 33 to version 34.
*/
-class Migration33 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Originally, this inserted entries into wt_site_access_rule,
- // however this table now gets deleted in Migration37.
- }
+class Migration33 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Originally, this inserted entries into wt_site_access_rule,
+ // however this table now gets deleted in Migration37.
+ }
}
diff --git a/app/Schema/Migration34.php b/app/Schema/Migration34.php
index 1d3725cad9..406b74f2f6 100644
--- a/app/Schema/Migration34.php
+++ b/app/Schema/Migration34.php
@@ -21,17 +21,19 @@ use Fisharebest\Webtrees\Module;
/**
* Upgrade the database schema from version 34 to version 35.
*/
-class Migration34 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // New modules (charts) have been added.
- Module::getInstalledModules('enabled');
+class Migration34 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // New modules (charts) have been added.
+ Module::getInstalledModules('enabled');
- // Delete old/unused settings
- Database::exec(
- "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('COMMON_NAMES_ADD', 'COMMON_NAMES_REMOVE', 'COMMON_NAMES_THRESHOLD')"
- );
- }
+ // Delete old/unused settings
+ Database::exec(
+ "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('COMMON_NAMES_ADD', 'COMMON_NAMES_REMOVE', 'COMMON_NAMES_THRESHOLD')"
+ );
+ }
}
diff --git a/app/Schema/Migration35.php b/app/Schema/Migration35.php
index be386c4577..aac97c0471 100644
--- a/app/Schema/Migration35.php
+++ b/app/Schema/Migration35.php
@@ -20,32 +20,34 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 35 to version 36.
*/
-class Migration35 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Use LONGTEXT instead of TEXT and MEDIUMTEXT, and make NOT NULL.
- Database::exec("UPDATE `##news` SET body = '' WHERE body IS NULL");
- Database::exec("UPDATE `##other` SET o_gedcom = '' WHERE o_gedcom IS NULL");
- Database::exec("UPDATE `##places` SET p_std_soundex = '' WHERE p_std_soundex IS NULL");
- Database::exec("UPDATE `##places` SET p_dm_soundex = '' WHERE p_dm_soundex IS NULL");
- Database::exec("ALTER TABLE `##block_setting` CHANGE setting_value setting_value LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
- Database::exec("ALTER TABLE `##change` CHANGE new_gedcom new_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
- Database::exec("ALTER TABLE `##change` CHANGE old_gedcom old_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
- Database::exec("ALTER TABLE `##families` CHANGE f_gedcom f_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
- Database::exec("ALTER TABLE `##individuals` CHANGE i_gedcom i_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
- Database::exec("ALTER TABLE `##log` CHANGE log_message log_message LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
- Database::exec("ALTER TABLE `##media` CHANGE m_gedcom m_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
- Database::exec("ALTER TABLE `##message` CHANGE body body LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
- Database::exec("ALTER TABLE `##module_setting` CHANGE setting_value setting_value LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
- Database::exec("ALTER TABLE `##news` CHANGE body body LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
- Database::exec("ALTER TABLE `##other` CHANGE o_gedcom o_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
- Database::exec("ALTER TABLE `##places` CHANGE p_std_soundex p_std_soundex LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
- Database::exec("ALTER TABLE `##places` CHANGE p_dm_soundex p_dm_soundex LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
- Database::exec("ALTER TABLE `##sources` CHANGE s_gedcom s_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
- // Use LONGBLOB instead of MEDIUMBLOB.
- Database::exec("ALTER TABLE `##gedcom_chunk` CHANGE chunk_data chunk_data LONGBLOB NOT NULL");
- Database::exec("ALTER TABLE `##session` CHANGE session_data session_data LONGBLOB NOT NULL");
- }
+class Migration35 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Use LONGTEXT instead of TEXT and MEDIUMTEXT, and make NOT NULL.
+ Database::exec("UPDATE `##news` SET body = '' WHERE body IS NULL");
+ Database::exec("UPDATE `##other` SET o_gedcom = '' WHERE o_gedcom IS NULL");
+ Database::exec("UPDATE `##places` SET p_std_soundex = '' WHERE p_std_soundex IS NULL");
+ Database::exec("UPDATE `##places` SET p_dm_soundex = '' WHERE p_dm_soundex IS NULL");
+ Database::exec("ALTER TABLE `##block_setting` CHANGE setting_value setting_value LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
+ Database::exec("ALTER TABLE `##change` CHANGE new_gedcom new_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
+ Database::exec("ALTER TABLE `##change` CHANGE old_gedcom old_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
+ Database::exec("ALTER TABLE `##families` CHANGE f_gedcom f_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
+ Database::exec("ALTER TABLE `##individuals` CHANGE i_gedcom i_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
+ Database::exec("ALTER TABLE `##log` CHANGE log_message log_message LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
+ Database::exec("ALTER TABLE `##media` CHANGE m_gedcom m_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
+ Database::exec("ALTER TABLE `##message` CHANGE body body LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
+ Database::exec("ALTER TABLE `##module_setting` CHANGE setting_value setting_value LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
+ Database::exec("ALTER TABLE `##news` CHANGE body body LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
+ Database::exec("ALTER TABLE `##other` CHANGE o_gedcom o_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
+ Database::exec("ALTER TABLE `##places` CHANGE p_std_soundex p_std_soundex LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
+ Database::exec("ALTER TABLE `##places` CHANGE p_dm_soundex p_dm_soundex LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
+ Database::exec("ALTER TABLE `##sources` CHANGE s_gedcom s_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
+ // Use LONGBLOB instead of MEDIUMBLOB.
+ Database::exec("ALTER TABLE `##gedcom_chunk` CHANGE chunk_data chunk_data LONGBLOB NOT NULL");
+ Database::exec("ALTER TABLE `##session` CHANGE session_data session_data LONGBLOB NOT NULL");
+ }
}
diff --git a/app/Schema/Migration36.php b/app/Schema/Migration36.php
index 8da2e497cb..1dbc187ee7 100644
--- a/app/Schema/Migration36.php
+++ b/app/Schema/Migration36.php
@@ -20,14 +20,16 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 36 to version 37.
*/
-class Migration36 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // IPv6 addresses can be up to 45 characters.
- Database::exec("ALTER TABLE `##log` CHANGE ip_address ip_address VARCHAR(45) NOT NULL");
- Database::exec("ALTER TABLE `##message` CHANGE ip_address ip_address VARCHAR(45) NOT NULL");
- Database::exec("ALTER TABLE `##session` CHANGE ip_address ip_address VARCHAR(45) NOT NULL");
- }
+class Migration36 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // IPv6 addresses can be up to 45 characters.
+ Database::exec("ALTER TABLE `##log` CHANGE ip_address ip_address VARCHAR(45) NOT NULL");
+ Database::exec("ALTER TABLE `##message` CHANGE ip_address ip_address VARCHAR(45) NOT NULL");
+ Database::exec("ALTER TABLE `##session` CHANGE ip_address ip_address VARCHAR(45) NOT NULL");
+ }
}
diff --git a/app/Schema/Migration37.php b/app/Schema/Migration37.php
index c6162cba57..cd731dce33 100644
--- a/app/Schema/Migration37.php
+++ b/app/Schema/Migration37.php
@@ -21,66 +21,68 @@ use PDOException;
/**
* Upgrade the database schema from version 37 to version 38.
*/
-class Migration37 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- Database::prepare(
- "DROP TABLE IF EXISTS `##site_access_rule`"
- )->execute();
+class Migration37 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ Database::prepare(
+ "DROP TABLE IF EXISTS `##site_access_rule`"
+ )->execute();
- try {
- Database::prepare(
- "INSERT INTO `##site_setting` (setting_name, setting_value)" .
- " SELECT 'next_xref', MAX(next_id) FROM `##next_id`"
- )->execute();
- } catch (PDOException $ex) {
- // Already done?
- }
+ try {
+ Database::prepare(
+ "INSERT INTO `##site_setting` (setting_name, setting_value)" .
+ " SELECT 'next_xref', MAX(next_id) FROM `##next_id`"
+ )->execute();
+ } catch (PDOException $ex) {
+ // Already done?
+ }
- Database::prepare(
- "DELETE FROM `##gedcom_setting` WHERE setting_name in ('FAM_ID_PREFIX', 'GEDCOM_ID_PREFIX', 'MEDIA_ID_PREFIX', 'NOTE_ID_PREFIX', 'REPO_ID_PREFIX', 'SOURCE_ID_PREFIX')"
- )->execute();
+ Database::prepare(
+ "DELETE FROM `##gedcom_setting` WHERE setting_name in ('FAM_ID_PREFIX', 'GEDCOM_ID_PREFIX', 'MEDIA_ID_PREFIX', 'NOTE_ID_PREFIX', 'REPO_ID_PREFIX', 'SOURCE_ID_PREFIX')"
+ )->execute();
- Database::prepare(
- "DROP TABLE IF EXISTS `##next_id`"
- )->execute();
+ Database::prepare(
+ "DROP TABLE IF EXISTS `##next_id`"
+ )->execute();
- Database::prepare(
- "CREATE TABLE IF NOT EXISTS `##media_file` (" .
- "id INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY," .
- "m_id VARCHAR(20) NOT NULL," .
- "m_file INTEGER NOT NULL," .
- "multimedia_file_refn VARCHAR(512) NOT NULL," . // GEDCOM only allows 30 characters
- "multimedia_format VARCHAR(4) NOT NULL," .
- "source_media_type VARCHAR(15) NOT NULL," .
- "descriptive_title VARCHAR(248) NOT NULL," .
- "KEY `##media_file_ix1` (m_id, m_file)," .
- "KEY `##media_file_ix2` (m_file, m_id)," .
- "KEY `##media_file_ix3` (m_file, multimedia_file_refn)," .
- "KEY `##media_file_ix4` (m_file, multimedia_format)," .
- "KEY `##media_file_ix5` (m_file, source_media_type)," .
- "KEY `##media_file_ix6` (m_file, descriptive_title)" .
- ") ENGINE=InnoDB COLLATE=utf8_unicode_ci"
- )->execute();
+ Database::prepare(
+ "CREATE TABLE IF NOT EXISTS `##media_file` (" .
+ "id INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY," .
+ "m_id VARCHAR(20) NOT NULL," .
+ "m_file INTEGER NOT NULL," .
+ "multimedia_file_refn VARCHAR(512) NOT NULL," . // GEDCOM only allows 30 characters
+ "multimedia_format VARCHAR(4) NOT NULL," .
+ "source_media_type VARCHAR(15) NOT NULL," .
+ "descriptive_title VARCHAR(248) NOT NULL," .
+ "KEY `##media_file_ix1` (m_id, m_file)," .
+ "KEY `##media_file_ix2` (m_file, m_id)," .
+ "KEY `##media_file_ix3` (m_file, multimedia_file_refn)," .
+ "KEY `##media_file_ix4` (m_file, multimedia_format)," .
+ "KEY `##media_file_ix5` (m_file, source_media_type)," .
+ "KEY `##media_file_ix6` (m_file, descriptive_title)" .
+ ") ENGINE=InnoDB COLLATE=utf8_unicode_ci"
+ )->execute();
- Database::prepare(
- "INSERT INTO `##media_file` (" .
- "m_id, m_file, multimedia_file_refn, multimedia_format, source_media_type, descriptive_title" .
- ") SELECT m_id, m_file, m_filename, m_ext, LEFT(m_type, 15), m_titl FROM `##media`"
- )->execute();
+ Database::prepare(
+ "INSERT INTO `##media_file` (" .
+ "m_id, m_file, multimedia_file_refn, multimedia_format, source_media_type, descriptive_title" .
+ ") SELECT m_id, m_file, m_filename, m_ext, LEFT(m_type, 15), m_titl FROM `##media`"
+ )->execute();
- try {
- Database::prepare(
- "ALTER TABLE `##media`" .
- " DROP COLUMN m_filename," .
- " DROP COLUMN m_ext," .
- " DROP COLUMN m_type," .
- " DROP COLUMN m_titl"
- )->execute();
- } catch (PDOException $ex) {
- // Already done?
- }
- }
+ try {
+ Database::prepare(
+ "ALTER TABLE `##media`" .
+ " DROP COLUMN m_filename," .
+ " DROP COLUMN m_ext," .
+ " DROP COLUMN m_type," .
+ " DROP COLUMN m_titl"
+ )->execute();
+ } catch (PDOException $ex) {
+ // Already done?
+ }
+ }
}
diff --git a/app/Schema/Migration38.php b/app/Schema/Migration38.php
index 00a5297360..4c97c13c1a 100644
--- a/app/Schema/Migration38.php
+++ b/app/Schema/Migration38.php
@@ -21,79 +21,81 @@ use PDOException;
/**
* Upgrade the database schema from version 38 to version 39.
*/
-class Migration38 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // The geographic data is now handled by the core code.
- // The following migrations were once part of the old googlemap module.
- try {
- // Create the tables, as per PhpGedView 4.2.1
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##placelocation` (" .
- " pl_id INTEGER NOT NULL," .
- " pl_parent_id INTEGER NULL," .
- " pl_level INTEGER NULL," .
- " pl_place VARCHAR(255) NULL," .
- " pl_long VARCHAR(30) NULL," .
- " pl_lati VARCHAR(30) NULL," .
- " pl_zoom INTEGER NULL," .
- " pl_icon VARCHAR(255) NULL," .
- " PRIMARY KEY (pl_id)," .
- " KEY ix1 (pl_level)," .
- " KEY ix2 (pl_long)," .
- " KEY ix3 (pl_lati)," .
- " KEY ix4 (pl_place)," .
- " KEY ix5 (pl_parent_id)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- } catch (PDOException $ex) {
- // Already done?
- }
+class Migration38 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // The geographic data is now handled by the core code.
+ // The following migrations were once part of the old googlemap module.
+ try {
+ // Create the tables, as per PhpGedView 4.2.1
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##placelocation` (" .
+ " pl_id INTEGER NOT NULL," .
+ " pl_parent_id INTEGER NULL," .
+ " pl_level INTEGER NULL," .
+ " pl_place VARCHAR(255) NULL," .
+ " pl_long VARCHAR(30) NULL," .
+ " pl_lati VARCHAR(30) NULL," .
+ " pl_zoom INTEGER NULL," .
+ " pl_icon VARCHAR(255) NULL," .
+ " PRIMARY KEY (pl_id)," .
+ " KEY ix1 (pl_level)," .
+ " KEY ix2 (pl_long)," .
+ " KEY ix3 (pl_lati)," .
+ " KEY ix4 (pl_place)," .
+ " KEY ix5 (pl_parent_id)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ } catch (PDOException $ex) {
+ // Already done?
+ }
- try {
- Database::exec(
- "ALTER TABLE `##placelocation` ADD (" .
- " pl_media VARCHAR(60) NULL," .
- " sv_long FLOAT NOT NULL DEFAULT 0," .
- " sv_lati FLOAT NOT NULL DEFAULT 0," .
- " sv_bearing FLOAT NOT NULL DEFAULT 0," .
- " sv_elevation FLOAT NOT NULL DEFAULT 0," .
- " sv_zoom FLOAT NOT NULL DEFAULT 1" .
- ")"
- );
- } catch (PDOException $ex) {
- // Already done?
- }
+ try {
+ Database::exec(
+ "ALTER TABLE `##placelocation` ADD (" .
+ " pl_media VARCHAR(60) NULL," .
+ " sv_long FLOAT NOT NULL DEFAULT 0," .
+ " sv_lati FLOAT NOT NULL DEFAULT 0," .
+ " sv_bearing FLOAT NOT NULL DEFAULT 0," .
+ " sv_elevation FLOAT NOT NULL DEFAULT 0," .
+ " sv_zoom FLOAT NOT NULL DEFAULT 1" .
+ ")"
+ );
+ } catch (PDOException $ex) {
+ // Already done?
+ }
- try {
- Database::exec("ALTER TABLE `##placelocation`" .
- " DROP COLUMN pl_media," .
- " DROP COLUMN sv_long," .
- " DROP COLUMN sv_lati," .
- " DROP COLUMN sv_bearing," .
- " DROP COLUMN sv_elevation," .
- " DROP COLUMN sv_zoom," .
- " DROP INDEX ix1," .
- " DROP INDEX ix2," .
- " DROP INDEX ix3," .
- " DROP INDEX ix4," .
- " DROP INDEX ix5," .
- " ADD UNIQUE INDEX ix1 (pl_parent_id, pl_place)," .
- " ADD INDEX ix2 (pl_parent_id)," .
- " ADD INDEX ix3 (pl_place)"
- );
- } catch (PDOException $ex) {
- // Already done?
- }
+ try {
+ Database::exec("ALTER TABLE `##placelocation`" .
+ " DROP COLUMN pl_media," .
+ " DROP COLUMN sv_long," .
+ " DROP COLUMN sv_lati," .
+ " DROP COLUMN sv_bearing," .
+ " DROP COLUMN sv_elevation," .
+ " DROP COLUMN sv_zoom," .
+ " DROP INDEX ix1," .
+ " DROP INDEX ix2," .
+ " DROP INDEX ix3," .
+ " DROP INDEX ix4," .
+ " DROP INDEX ix5," .
+ " ADD UNIQUE INDEX ix1 (pl_parent_id, pl_place)," .
+ " ADD INDEX ix2 (pl_parent_id)," .
+ " ADD INDEX ix3 (pl_place)"
+ );
+ } catch (PDOException $ex) {
+ // Already done?
+ }
- // Convert flag icons from .gif to .png
- Database::exec("UPDATE `##placelocation` SET pl_icon=REPLACE(pl_icon, '.gif', '.png')");
+ // Convert flag icons from .gif to .png
+ Database::exec("UPDATE `##placelocation` SET pl_icon=REPLACE(pl_icon, '.gif', '.png')");
- // Delete old settings
- Database::exec("DELETE FROM `##module_setting` WHERE module_name='googlemap'");
- Database::exec("DELETE FROM `##module_privacy` WHERE module_name='googlemap'");
- Database::exec("DELETE FROM `##module` WHERE module_name='googlemap'");
- }
+ // Delete old settings
+ Database::exec("DELETE FROM `##module_setting` WHERE module_name='googlemap'");
+ Database::exec("DELETE FROM `##module_privacy` WHERE module_name='googlemap'");
+ Database::exec("DELETE FROM `##module` WHERE module_name='googlemap'");
+ }
}
diff --git a/app/Schema/Migration39.php b/app/Schema/Migration39.php
index 2bcb3aa3ef..d78a455e2e 100644
--- a/app/Schema/Migration39.php
+++ b/app/Schema/Migration39.php
@@ -22,110 +22,112 @@ use PDOException;
/**
* Upgrade the database schema from version 39 to version 40.
*/
-class Migration39 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // The following migrations were once part of the favorites module.
+class Migration39 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // The following migrations were once part of the favorites module.
- // Create the tables, as per PhpGedView 4.2.1
- Database::exec(
- "CREATE TABLE IF NOT EXISTS `##favorites` (" .
- " fv_id INTEGER AUTO_INCREMENT NOT NULL," .
- " fv_username VARCHAR(32) NOT NULL," .
- " fv_gid VARCHAR(20) NULL," .
- " fv_type VARCHAR(15) NULL," .
- " fv_file VARCHAR(100) NULL," .
- " fv_url VARCHAR(255) NULL," .
- " fv_title VARCHAR(255) NULL," .
- " fv_note TEXT NULL," .
- " PRIMARY KEY (fv_id)," .
- " KEY ix1 (fv_username)" .
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
+ // Create the tables, as per PhpGedView 4.2.1
+ Database::exec(
+ "CREATE TABLE IF NOT EXISTS `##favorites` (" .
+ " fv_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " fv_username VARCHAR(32) NOT NULL," .
+ " fv_gid VARCHAR(20) NULL," .
+ " fv_type VARCHAR(15) NULL," .
+ " fv_file VARCHAR(100) NULL," .
+ " fv_url VARCHAR(255) NULL," .
+ " fv_title VARCHAR(255) NULL," .
+ " fv_note TEXT NULL," .
+ " PRIMARY KEY (fv_id)," .
+ " KEY ix1 (fv_username)" .
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
- // Add the new columns
- try {
- Database::exec(
- "ALTER TABLE `##favorites`" .
- " CHANGE fv_id favorite_id INTEGER AUTO_INCREMENT NOT NULL," .
- " CHANGE fv_gid xref VARCHAR(20) NULL," .
- " CHANGE fv_type favorite_type ENUM('INDI', 'FAM', 'SOUR', 'REPO', 'OBJE', 'NOTE', 'URL') NOT NULL," .
- " CHANGE fv_url url VARCHAR(255) NULL," .
- " CHANGE fv_title title VARCHAR(255) NULL," .
- " CHANGE fv_note note VARCHAR(1000) NULL," .
- " ADD user_id INTEGER NULL AFTER favorite_id," .
- " ADD gedcom_id INTEGER NOT NULL AFTER user_id," .
- " DROP KEY ix1," .
- " ADD KEY news_ix1 (gedcom_id, user_id)"
- );
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+ // Add the new columns
+ try {
+ Database::exec(
+ "ALTER TABLE `##favorites`" .
+ " CHANGE fv_id favorite_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " CHANGE fv_gid xref VARCHAR(20) NULL," .
+ " CHANGE fv_type favorite_type ENUM('INDI', 'FAM', 'SOUR', 'REPO', 'OBJE', 'NOTE', 'URL') NOT NULL," .
+ " CHANGE fv_url url VARCHAR(255) NULL," .
+ " CHANGE fv_title title VARCHAR(255) NULL," .
+ " CHANGE fv_note note VARCHAR(1000) NULL," .
+ " ADD user_id INTEGER NULL AFTER favorite_id," .
+ " ADD gedcom_id INTEGER NOT NULL AFTER user_id," .
+ " DROP KEY ix1," .
+ " ADD KEY news_ix1 (gedcom_id, user_id)"
+ );
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Already updated?
- }
+ // Already updated?
+ }
- // Migrate data from the old columns to the new ones
- try {
- Database::exec(
- "UPDATE `##favorites` f" .
- " LEFT JOIN `##gedcom` g ON (f.fv_file =g.gedcom_name)" .
- " LEFT JOIN `##user` u ON (f.fv_username=u.user_name)" .
- " SET f.gedcom_id=g.gedcom_id, f.user_id=u.user_id"
- );
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+ // Migrate data from the old columns to the new ones
+ try {
+ Database::exec(
+ "UPDATE `##favorites` f" .
+ " LEFT JOIN `##gedcom` g ON (f.fv_file =g.gedcom_name)" .
+ " LEFT JOIN `##user` u ON (f.fv_username=u.user_name)" .
+ " SET f.gedcom_id=g.gedcom_id, f.user_id=u.user_id"
+ );
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Already updated?
- }
+ // Already updated?
+ }
- // Delete orphaned rows
- Database::exec(
- "DELETE FROM `##favorites` WHERE user_id IS NULL AND gedcom_id IS NULL"
- );
+ // Delete orphaned rows
+ Database::exec(
+ "DELETE FROM `##favorites` WHERE user_id IS NULL AND gedcom_id IS NULL"
+ );
- // Delete the old column
- try {
- Database::exec(
- "ALTER TABLE `##favorites` DROP fv_username, DROP fv_file"
- );
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+ // Delete the old column
+ try {
+ Database::exec(
+ "ALTER TABLE `##favorites` DROP fv_username, DROP fv_file"
+ );
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Already updated?
- }
+ // Already updated?
+ }
- // Rename the table
- try {
- Database::exec(
- "RENAME TABLE `##favorites` TO `##favorite`"
- );
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+ // Rename the table
+ try {
+ Database::exec(
+ "RENAME TABLE `##favorites` TO `##favorite`"
+ );
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Already updated?
- }
+ // Already updated?
+ }
- // Add foreign key constraints
- // Delete any data that might violate the new constraints
- Database::exec(
- "DELETE FROM `##favorite`" .
- " WHERE user_id NOT IN (SELECT user_id FROM `##user` )" .
- " OR gedcom_id NOT IN (SELECT gedcom_id FROM `##gedcom`)"
- );
+ // Add foreign key constraints
+ // Delete any data that might violate the new constraints
+ Database::exec(
+ "DELETE FROM `##favorite`" .
+ " WHERE user_id NOT IN (SELECT user_id FROM `##user` )" .
+ " OR gedcom_id NOT IN (SELECT gedcom_id FROM `##gedcom`)"
+ );
- // Add the new constraints
- try {
- Database::exec(
- "ALTER TABLE `##favorite`" .
- " ADD FOREIGN KEY `##favorite_fk1` (user_id ) REFERENCES `##user` (user_id) ON DELETE CASCADE," .
- " ADD FOREIGN KEY `##favorite_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE"
- );
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+ // Add the new constraints
+ try {
+ Database::exec(
+ "ALTER TABLE `##favorite`" .
+ " ADD FOREIGN KEY `##favorite_fk1` (user_id ) REFERENCES `##user` (user_id) ON DELETE CASCADE," .
+ " ADD FOREIGN KEY `##favorite_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE"
+ );
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Already updated?
- }
- }
+ // Already updated?
+ }
+ }
}
diff --git a/app/Schema/Migration4.php b/app/Schema/Migration4.php
index 64754bf892..8a373051c9 100644
--- a/app/Schema/Migration4.php
+++ b/app/Schema/Migration4.php
@@ -22,33 +22,35 @@ use PDOException;
/**
* Upgrade the database schema from version 4 to version 5.
*/
-class Migration4 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Add support for sorting gedcoms non-alphabetically
- // Also clean out some old/unused values and files.
- try {
- Database::exec("ALTER TABLE `##gedcom` ADD COLUMN sort_order INTEGER NOT NULL DEFAULT 0");
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+class Migration4 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Add support for sorting gedcoms non-alphabetically
+ // Also clean out some old/unused values and files.
+ try {
+ Database::exec("ALTER TABLE `##gedcom` ADD COLUMN sort_order INTEGER NOT NULL DEFAULT 0");
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // If this fails, it has probably already been done.
- }
+ // If this fails, it has probably already been done.
+ }
- try {
- Database::exec("ALTER TABLE `##gedcom` ADD INDEX ix1 (sort_order)");
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+ try {
+ Database::exec("ALTER TABLE `##gedcom` ADD INDEX ix1 (sort_order)");
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // If this fails, it has probably already been done.
- }
+ // If this fails, it has probably already been done.
+ }
- // No longer used
- Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('PAGE_AFTER_LOGIN')");
+ // No longer used
+ Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('PAGE_AFTER_LOGIN')");
- // Change of defaults - do not add ASSO, etc. to NOTE objects
- Database::exec("UPDATE `##gedcom_setting` SET setting_value='SOUR' WHERE setting_value='ASSO,SOUR,NOTE,REPO' AND setting_name='NOTE_FACTS_ADD'");
- }
+ // Change of defaults - do not add ASSO, etc. to NOTE objects
+ Database::exec("UPDATE `##gedcom_setting` SET setting_value='SOUR' WHERE setting_value='ASSO,SOUR,NOTE,REPO' AND setting_name='NOTE_FACTS_ADD'");
+ }
}
diff --git a/app/Schema/Migration5.php b/app/Schema/Migration5.php
index 5e09c2fd5a..5a5ff33e33 100644
--- a/app/Schema/Migration5.php
+++ b/app/Schema/Migration5.php
@@ -20,32 +20,34 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 5 to version 6.
*/
-class Migration5 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Changes to the values for the gedcom setting SHOW_RELATIVES_EVENTS
- $settings = Database::prepare("SELECT gedcom_id, setting_value FROM `##gedcom_setting` WHERE setting_name='SHOW_RELATIVES_EVENTS'")->fetchAssoc();
+class Migration5 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Changes to the values for the gedcom setting SHOW_RELATIVES_EVENTS
+ $settings = Database::prepare("SELECT gedcom_id, setting_value FROM `##gedcom_setting` WHERE setting_name='SHOW_RELATIVES_EVENTS'")->fetchAssoc();
- foreach ($settings as $gedcom_id => $setting) {
- // Delete old settings
- $setting = preg_replace('/_(BIRT|MARR|DEAT)_(COUS|MSIB|FSIB|GGCH|NEPH|GGPA)/', '', $setting);
- $setting = preg_replace('/_FAMC_(RESI_EMIG)/', '', $setting);
- // Rename settings
- $setting = preg_replace('/_MARR_(MOTH|FATH|FAMC)/', '_MARR_PARE', $setting);
- $setting = preg_replace('/_DEAT_(MOTH|FATH)/', '_DEAT_PARE', $setting);
- // Remove duplicates
- preg_match_all('/[_A-Z]+/', $setting, $match);
- // And save
- Database::prepare(
- "UPDATE `##gedcom_setting`" .
- " SET setting_value = :setting_value" .
- " WHERE gedcom_id = :tree_id AND setting_name = 'SHOW_RELATIVES_EVENTS'"
- )->execute([
- 'tree_id' => $gedcom_id,
- 'setting_value' => implode(',', array_unique($match[0])),
- ]);
- }
- }
+ foreach ($settings as $gedcom_id => $setting) {
+ // Delete old settings
+ $setting = preg_replace('/_(BIRT|MARR|DEAT)_(COUS|MSIB|FSIB|GGCH|NEPH|GGPA)/', '', $setting);
+ $setting = preg_replace('/_FAMC_(RESI_EMIG)/', '', $setting);
+ // Rename settings
+ $setting = preg_replace('/_MARR_(MOTH|FATH|FAMC)/', '_MARR_PARE', $setting);
+ $setting = preg_replace('/_DEAT_(MOTH|FATH)/', '_DEAT_PARE', $setting);
+ // Remove duplicates
+ preg_match_all('/[_A-Z]+/', $setting, $match);
+ // And save
+ Database::prepare(
+ "UPDATE `##gedcom_setting`" .
+ " SET setting_value = :setting_value" .
+ " WHERE gedcom_id = :tree_id AND setting_name = 'SHOW_RELATIVES_EVENTS'"
+ )->execute([
+ 'tree_id' => $gedcom_id,
+ 'setting_value' => implode(',', array_unique($match[0])),
+ ]);
+ }
+ }
}
diff --git a/app/Schema/Migration6.php b/app/Schema/Migration6.php
index 38473e3ac7..e6d04e5e6d 100644
--- a/app/Schema/Migration6.php
+++ b/app/Schema/Migration6.php
@@ -22,34 +22,36 @@ use PDOException;
/**
* Upgrade the database schema from version 6 to version 7.
*/
-class Migration6 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Remove tables/columns relating to remote linking
- Database::exec(
- "DROP TABLE IF EXISTS `##remotelinks`"
- );
+class Migration6 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Remove tables/columns relating to remote linking
+ Database::exec(
+ "DROP TABLE IF EXISTS `##remotelinks`"
+ );
- try {
- Database::exec(
- "ALTER TABLE `##sources` DROP INDEX ix2"
- );
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+ try {
+ Database::exec(
+ "ALTER TABLE `##sources` DROP INDEX ix2"
+ );
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // already been done?
- }
+ // already been done?
+ }
- try {
- Database::exec(
- "ALTER TABLE `##sources` DROP COLUMN s_dbid"
- );
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+ try {
+ Database::exec(
+ "ALTER TABLE `##sources` DROP COLUMN s_dbid"
+ );
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // already been done?
- }
- }
+ // already been done?
+ }
+ }
}
diff --git a/app/Schema/Migration7.php b/app/Schema/Migration7.php
index 69252e087a..04fc14655f 100644
--- a/app/Schema/Migration7.php
+++ b/app/Schema/Migration7.php
@@ -20,20 +20,22 @@ use Fisharebest\Webtrees\Database;
/**
* Upgrade the database schema from version 7 to version 8.
*/
-class Migration7 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Update config data defining theme selection
- Database::exec(
- "UPDATE `##gedcom_setting` SET setting_value=TRIM(LEADING 'themes/' FROM TRIM(TRAILING '/' FROM setting_value)) WHERE setting_name='THEME_DIR'"
- );
- Database::exec(
- "UPDATE `##user_setting` SET setting_value=TRIM(LEADING 'themes/' FROM TRIM(TRAILING '/' FROM setting_value)) WHERE setting_name='THEME_DIR'"
- );
- Database::exec(
- "UPDATE `##user_gedcom_setting` SET setting_value=TRIM(LEADING 'themes/' FROM TRIM(TRAILING '/' FROM setting_value)) WHERE setting_name='THEME_DIR'"
- );
- }
+class Migration7 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Update config data defining theme selection
+ Database::exec(
+ "UPDATE `##gedcom_setting` SET setting_value=TRIM(LEADING 'themes/' FROM TRIM(TRAILING '/' FROM setting_value)) WHERE setting_name='THEME_DIR'"
+ );
+ Database::exec(
+ "UPDATE `##user_setting` SET setting_value=TRIM(LEADING 'themes/' FROM TRIM(TRAILING '/' FROM setting_value)) WHERE setting_name='THEME_DIR'"
+ );
+ Database::exec(
+ "UPDATE `##user_gedcom_setting` SET setting_value=TRIM(LEADING 'themes/' FROM TRIM(TRAILING '/' FROM setting_value)) WHERE setting_name='THEME_DIR'"
+ );
+ }
}
diff --git a/app/Schema/Migration8.php b/app/Schema/Migration8.php
index bfbe433a6e..a093789790 100644
--- a/app/Schema/Migration8.php
+++ b/app/Schema/Migration8.php
@@ -22,20 +22,22 @@ use PDOException;
/**
* Upgrade the database schema from version 8 to version 9.
*/
-class Migration8 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Add support for the persian/jalali calendar
- try {
- Database::exec(
- "ALTER TABLE `##dates` CHANGE d_type d_type ENUM('@#DGREGORIAN@', '@#DJULIAN@', '@#DHEBREW@', '@#DFRENCH R@', '@#DHIJRI@', '@#DROMAN@', '@#DJALALI@')"
- );
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+class Migration8 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Add support for the persian/jalali calendar
+ try {
+ Database::exec(
+ "ALTER TABLE `##dates` CHANGE d_type d_type ENUM('@#DGREGORIAN@', '@#DJULIAN@', '@#DHEBREW@', '@#DFRENCH R@', '@#DHIJRI@', '@#DROMAN@', '@#DJALALI@')"
+ );
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Already been run?
- }
- }
+ // Already been run?
+ }
+ }
}
diff --git a/app/Schema/Migration9.php b/app/Schema/Migration9.php
index e71ad80221..24e87e6c9f 100644
--- a/app/Schema/Migration9.php
+++ b/app/Schema/Migration9.php
@@ -22,31 +22,33 @@ use PDOException;
/**
* Upgrade the database schema from version 9 to version 10.
*/
-class Migration9 implements MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade() {
- // Change index on name table
- try {
- Database::exec(
- "ALTER TABLE `##dates` CHANGE d_type d_type ENUM('@#DGREGORIAN@', '@#DJULIAN@', '@#DHEBREW@', '@#DFRENCH R@', '@#DHIJRI@', '@#DROMAN@', '@#DJALALI@')"
- );
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+class Migration9 implements MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade()
+ {
+ // Change index on name table
+ try {
+ Database::exec(
+ "ALTER TABLE `##dates` CHANGE d_type d_type ENUM('@#DGREGORIAN@', '@#DJULIAN@', '@#DHEBREW@', '@#DFRENCH R@', '@#DHIJRI@', '@#DROMAN@', '@#DJALALI@')"
+ );
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Already been run?
- }
+ // Already been run?
+ }
- try {
- // The INDILIST and FAMLIST scripts have been rewritten to use this index
- Database::exec(
- "ALTER TABLE `##name` DROP INDEX ix2, ADD INDEX ix2 (n_surn, n_file, n_type, n_id), ADD INDEX ix3 (n_givn, n_file, n_type, n_id)"
- );
- } catch (PDOException $ex) {
- DebugBar::addThrowable($ex);
+ try {
+ // The INDILIST and FAMLIST scripts have been rewritten to use this index
+ Database::exec(
+ "ALTER TABLE `##name` DROP INDEX ix2, ADD INDEX ix2 (n_surn, n_file, n_type, n_id), ADD INDEX ix3 (n_givn, n_file, n_type, n_id)"
+ );
+ } catch (PDOException $ex) {
+ DebugBar::addThrowable($ex);
- // Already been run?
- }
- }
+ // Already been run?
+ }
+ }
}
diff --git a/app/Schema/MigrationInterface.php b/app/Schema/MigrationInterface.php
index 2912c1674a..94a83a9aa6 100644
--- a/app/Schema/MigrationInterface.php
+++ b/app/Schema/MigrationInterface.php
@@ -18,9 +18,10 @@ namespace Fisharebest\Webtrees\Schema;
/**
* Upgrade the database schema.
*/
-interface MigrationInterface {
- /**
- * Upgrade to to the next version
- */
- public function upgrade();
+interface MigrationInterface
+{
+ /**
+ * Upgrade to to the next version
+ */
+ public function upgrade();
}