<?php

$inIndex = true;
require_once "../lib/setup/databaseInfo.php";
require_once "../lib/database.php";
require_once "../lib/atlasses.php";
require_once "../lib/objects.php";
require_once "../lib/setup/language/nl/lang_main.php";
$objDatabase = new Database();
$objAtlas = new Atlasses();
print "Database update will add the interstellarum atlas as one of the standard atlasses.\n";
$sql = "INSERT INTO atlasses VALUES ('Interstellarum');";
$run = mysql_query($sql) or die(mysql_error());
$sql = "ALTER TABLE objects ADD COLUMN Interstellarum VARCHAR(4) NOT NULL DEFAULT 0 ;";
$run = mysql_query($sql) or die(mysql_error());
$result = $objDatabase->selectRecordsetArray("SELECT name, ra, decl FROM objects");
while (list($key, $value) = each($result)) {
    $objDatabase->execSQL("UPDATE objects SET Interstellarum = \"" . $objAtlas->calculateAtlasPage('Interstellarum', $value['ra'], $value['decl']) . "\" WHERE name = \"" . $value['name'] . "\"");
}
print "Database update successful.\n";
?>

$run = mysql_query($sql) or die(mysql_error());
$sql = "INSERT INTO atlasses(atlasCode) VALUES ('milleniumbase')";
$run = mysql_query($sql) or die(mysql_error());
$sql = "INSERT INTO atlasses(atlasCode) VALUES ('taki')";
$run = mysql_query($sql) or die(mysql_error());
$sql = "INSERT INTO atlasses(atlasCode) VALUES ('psa')";
$run = mysql_query($sql) or die(mysql_error());
$sql = "INSERT INTO atlasses(atlasCode) VALUES ('torresB')";
$run = mysql_query($sql) or die(mysql_error());
$sql = "INSERT INTO atlasses(atlasCode) VALUES ('torresBC')";
$run = mysql_query($sql) or die(mysql_error());
$sql = "INSERT INTO atlasses(atlasCode) VALUES ('torresC')";
$run = mysql_query($sql) or die(mysql_error());
require_once "../lib/atlasses.php";
$object = new Objects();
$atlas = new Atlasses();
$sql = "ALTER TABLE objects MODIFY COLUMN description VARCHAR(1024) NOT NULL DEFAULT '';";
$run = mysql_query($sql) or die(mysql_error());
// Insert the psa, torresB, torresBC, torresC pages
$sql = "ALTER TABLE objects ADD COLUMN psa varchar(3) NOT NULL default ''";
$run = mysql_query($sql) or die(mysql_error());
$sql = "ALTER TABLE objects ADD COLUMN torresB varchar(3) NOT NULL default ''";
$run = mysql_query($sql) or die(mysql_error());
$sql = "ALTER TABLE objects ADD COLUMN torresBC varchar(3) NOT NULL default ''";
$run = mysql_query($sql) or die(mysql_error());
$sql = "ALTER TABLE objects ADD COLUMN torresC varchar(3) NOT NULL default ''";
$run = mysql_query($sql) or die(mysql_error());
// Insert the estimated small and large diameter in arc minutes
$sql = "ALTER TABLE observations ADD COLUMN smallDiameter float NOT NULL default '0.0'";
$run = mysql_query($sql) or die(mysql_error());
$sql = "ALTER TABLE observations ADD COLUMN largeDiameter float NOT NULL default '0.0'";
<?php

$inIndex = true;
require_once "../lib/setup/databaseInfo.php";
require_once "../lib/database.php";
require_once "../lib/atlasses.php";
require_once "../lib/objects.php";
require_once "../lib/setup/language/nl/lang_main.php";
$objDatabase = new Database();
$objAtlas = new Atlasses();
print "Database update will add the deepskylog atlasses page numbers for the DSL objects.\n";
$result = $objDatabase->selectRecordsetArray("SELECT name, ra, decl FROM objects");
while (list($key, $value) = each($result)) {
    $objDatabase->execSQL("UPDATE objects SET DSLDL         = \"" . $objAtlas->calculateAtlasPage('DSLDL', $value['ra'], $value['decl']) . "\" WHERE name = \"" . $value['name'] . "\"");
    $objDatabase->execSQL("UPDATE objects SET DSLDP         = \"" . $objAtlas->calculateAtlasPage('DSLDP', $value['ra'], $value['decl']) . "\" WHERE name = \"" . $value['name'] . "\"");
    $objDatabase->execSQL("UPDATE objects SET DSLLL         = \"" . $objAtlas->calculateAtlasPage('DSLLL', $value['ra'], $value['decl']) . "\" WHERE name = \"" . $value['name'] . "\"");
    $objDatabase->execSQL("UPDATE objects SET DSLLP         = \"" . $objAtlas->calculateAtlasPage('DSLLP', $value['ra'], $value['decl']) . "\" WHERE name = \"" . $value['name'] . "\"");
    $objDatabase->execSQL("UPDATE objects SET DSLOL         = \"" . $objAtlas->calculateAtlasPage('DSLOL', $value['ra'], $value['decl']) . "\" WHERE name = \"" . $value['name'] . "\"");
    $objDatabase->execSQL("UPDATE objects SET DSLOP         = \"" . $objAtlas->calculateAtlasPage('DSLOP', $value['ra'], $value['decl']) . "\" WHERE name = \"" . $value['name'] . "\"");
    $objDatabase->execSQL("UPDATE objects SET DeepskyHunter = \"" . $objAtlas->calculateAtlasPage('DeepskyHunter', $value['ra'], $value['decl']) . "\" WHERE name = \"" . $value['name'] . "\"");
}
print "Database update successful.\n";