forked from tomclegg/get-evidence
-
Notifications
You must be signed in to change notification settings - Fork 1
/
upgrade.php
executable file
·32 lines (27 loc) · 1.16 KB
/
upgrade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/php
<?php
;
// Copyright: see COPYING
// Authors: see git-blame(1)
chdir ('public_html');
require_once 'lib/setup.php';
require_once 'lib/aa.php';
print "Creating/updating get-evidence tables...";
evidence_create_tables ();
print "\n";
print "Checking for variant rows with aa_from/aa_to but no aa_del/aa_ins...";
if (theDb()->getOne ("select 1 from variants where variant_aa_del is null or variant_aa_ins is null limit 1")) {
print "\nFilling in missing variant_aa_ins, variant_aa_del...";
foreach ($aa_31 as $long => $short) {
theDb()->query ("update variants set variant_aa_del=? where variant_aa_from=? and variant_aa_del is null", array ($short, $long));
theDb()->query ("update variants set variant_aa_ins=? where variant_aa_to=? and variant_aa_ins is null", array ($short, $long));
}
print "\n";
$n = theDb()->getOne ("select count(*) from variants where variant_rsid is null and (variant_aa_del is null or variant_aa_ins is null)");
if ($n > 0) {
print "WARNING: you have $n rows in your variants table with no rsid and NULL in either variant_aa_del or variant_aa_ins.\n";
}
}
else {
print " none found, all good.\n";
}