Skip to content

Commit

Permalink
Update schema to include tag_rounds.
Browse files Browse the repository at this point in the history
And fix catastrophe in previous schema updater.
  • Loading branch information
kohler committed Oct 12, 2023
1 parent d72fd19 commit 3a6a086
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/conference.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ function __load_settings() {

function load_settings() {
$this->__load_settings();
if ($this->sversion < 282) {
if ($this->sversion < 283) {
$old_nerrors = Dbl::$nerrors;
while ((new UpdateSchema($this))->run()) {
usleep(50000);
Expand Down
2 changes: 1 addition & 1 deletion src/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ CREATE TABLE `TopicInterest` (
-- Initial settings
-- (each setting must be on its own line for createdb.sh)
insert into Settings (name, value, data) values
('allowPaperOption', 282, null), -- schema version
('allowPaperOption', 283, null), -- schema version
('setupPhase', 1, null), -- initial user is chair
('no_papersub', 1, null), -- no submissions yet
('sub_pcconf', 1, null), -- collect PC conflicts, not collaborators
Expand Down
21 changes: 20 additions & 1 deletion src/updateschema.php
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,21 @@ private function v282_update_viewrev() {
$conf->save_setting("__extrev_seerev_v282", 1);
}

private function v283_ensure_rev_roundtag() {
$t1 = $this->conf->setting_data("rev_roundtag") ?? "";
$t2 = $this->conf->setting_data("extrev_roundtag") ?? "";
$tl = $tlx = trim($this->conf->setting_data("tag_rounds") ?? "");
if ($t1 !== "" && strcasecmp($t1, "unnamed") !== 0 && stripos(" {$tlx} ", $t1) === false) {
$tlx = $tlx === "" ? $t1 : "{$tlx} {$t1}";
}
if ($t2 !== "" && strcasecmp($t2, "unnamed") !== 0 && stripos(" {$tlx} ", $t2) === false) {
$tlx = $tlx === "" ? $t2 : "{$tlx} {$t2}";
}
if ($tlx !== $tl) {
$this->conf->save_setting("tag_rounds", 1, $tlx);
}
}

/** @return bool */
function run() {
$conf = $this->conf;
Expand Down Expand Up @@ -1242,7 +1257,7 @@ function run() {
}

// update extrev_seerev => view_rev_ext
if ($conf->sversion <= 282
if ($conf->sversion <= 281
&& !$conf->setting("__extrev_seerev_v282")) {
$this->v282_update_viewrev();
}
Expand Down Expand Up @@ -2908,6 +2923,10 @@ function run() {
$conf->save_setting("__extrev_seerev_v282", null);
$conf->update_schema_version(282);
}
if ($conf->sversion === 282) {
$this->v283_ensure_rev_roundtag();
$conf->update_schema_version(283);
}

$conf->ql_ok("delete from Settings where name='__schema_lock'");
Conf::$main = $old_conf_g;
Expand Down

0 comments on commit 3a6a086

Please sign in to comment.