<?php
#
# apply new ->unpack() normalization to submitter/_image from existing project entries
#

include "config.php";

$r = db("SELECT * FROM release");

foreach ($r->into("release") as $project) {

    $project->unpack($project);
    $project = $project->getArrayCopy();
    $newdata = array_intersect_key($project, array_flip(str_getcsv("submitter,submitter_image")));
    $curkeys = array_intersect_key($project, array_flip(str_getcsv("name,version,t_published,t_changed")));
    
    print_r($project);
    db([
       "UPDATE release SET :, " => $newdata,
                    "WHERE :& " => $curkeys,
    ]);
}
