<?php

define(
'BASE_PATH',
realpath(__DIR__.'/../..')
);

require_once BASE_PATH.'/config/autoload.php';
require_once BASE_PATH.'/config/bootstrap.php';

$db=\App\Core\Database::getInstance();

echo "ORCHESTRATION APPROVALS\n";

$db->exec(
"TRUNCATE TABLE orchestration_action_approvals"
);

$rows=
$db->query("
SELECT *
FROM autonomous_review_orchestration
")->fetchAll(PDO::FETCH_ASSOC);

foreach($rows as $r){

    $db->prepare("
    INSERT INTO
    orchestration_action_approvals
    (
        orchestration_id,
        conference_id,
        approval_status
    )
    VALUES
    (
        ?,?,
        'pending'
    )
    ")->execute([
        $r['id'],
        $r['conference_id']
    ]);

}

echo "DONE\n";
