aboutsummaryrefslogtreecommitdiffstats
path: root/bin/update-schema
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-11-20 16:40:53 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-11-26 12:49:23 +0000
commiteb2aba46eabc8d90656b760cf4900f56119de9ca (patch)
treeafdf23b1a49424aa0c46019f8354f46b778dcf5c /bin/update-schema
parentd04d807989eaedb1bd46d08bf80e1b42ed7800ae (diff)
Store all moderation change history in database.
Currently keeping the same front end functionality of only reverting to the original.
Diffstat (limited to 'bin/update-schema')
-rwxr-xr-xbin/update-schema7
1 files changed, 7 insertions, 0 deletions
diff --git a/bin/update-schema b/bin/update-schema
index a2f20c306..55a052ccc 100755
--- a/bin/update-schema
+++ b/bin/update-schema
@@ -212,6 +212,7 @@ else {
# (assuming schema change files are never half-applied, which should be the case)
sub get_db_version {
return 'EMPTY' if ! table_exists('problem');
+ return '0064' if index_exists('moderation_original_data_problem_id_comment_id_idx');
return '0063' if column_exists('moderation_original_data', 'extra');
return '0062' if column_exists('users', 'created');
return '0061' if column_exists('body', 'extra');
@@ -320,3 +321,9 @@ sub function_exists {
my $fn = shift;
return $db->dbh->selectrow_array('select count(*) from pg_proc where proname = ?', {}, $fn);
}
+
+# Returns true if an index exists
+sub index_exists {
+ my $idx = shift;
+ return $db->dbh->selectrow_array('select count(*) from pg_indexes where indexname = ?', {}, $idx);
+}