<?php
if (!defined('ROOTPATH')) exit();

if ($old_version < 7) {
    echo "Duplicating project ids to new column ...<br/>";

    $sql = "SELECT id FROM mgw_projects";
    if(!$res = $conn->Execute($sql)) die(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));

    while($row = $res->FetchRow()) {
	$sql = "UPDATE mgw_projects SET project_id=".(int)$row["id"]." WHERE id=".(int)$row["id"];
	if(!$conn->Execute($sql)) die(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
    }
}
?>
