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
|
<?php
namespace mcoop;
require_once("common/db_classes.php");
class TaskDividendCreditsUpgrader extends BaseIncrementalTableUpgrader {
function __construct($conn) {
$this->conn = $conn;
$this->table_name = "task_dividend_credits";
}
}
$task_dividend_credits_table_decl = new SimpleTableDecl(
"task_dividend_credits",
array(
"create_new_tdc" => "INSERT INTO task_dividend_credits (task_id, posted_userid, posted_by_coop, total_credits, remaining_credits, last_updated_table_version) VALUES (:task_id, :userid, :coop_post, :credits, :credits, :table_ver)",
"tdc_remove_credits" => "UPDATE task_dividend_credits SET remaining_credits=remaining_credits - :amount WHERE tdc_id = :tdc_id",
"get_tdcs_by_taskid" => "SELECT * FROM task_dividend_credits WHERE task_id=:task_id"
),
"CREATE TABLE `task_dividend_credits` (
`tdc_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`task_id` INT NOT NULL,
`posted_userid` INT NOT NULL,
`posted_by_coop` BOOL NOT NULL,
`total_credits` BIGINT NOT NULL,
`remaining_credits` BIGINT NOT NULL,
`last_updated_table_version` INT NOT NULL
);",
1,
"\mcoop\TaskDividendCreditsUpgrader"
);
?>
|