summaryrefslogtreecommitdiff
path: root/common/tables/task_claims.php
blob: 4f309644f48cc4fe3aeafa7aaa8741c601dca101 (plain)
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 TaskClaimsUpgrader extends BaseIncrementalTableUpgrader {
	function __construct($conn) {
		$this->conn = $conn;
		$this->table_name = "task_claims";
	}
}

$task_claims_table_decl = new SimpleTableDecl(
	"task_claims",
	array(
		"create_task_claim" => "INSERT INTO task_claims (task_id, userid, last_updated_table_version, description) VALUES (:task_id, :userid, :table_ver, :description)",
		// something that might be interesting is also keying on WHERE userid=:userid so the user that created it's the only one that can update it, I'll probably do something with perms though (that's a TODO)
		"update_task_claim_desc" => "UPDATE task_claims SET description=:desc WHERE claim_id=:claim_id",
		"get_task_claim_ids_by_taskid" => "SELECT claim_id FROM task_claims WHERE task_id=:task_id",
		"get_task_claims_by_taskid" => "SELECT * FROM task_claims WHERE task_id=:task_id"
	),
	"CREATE TABLE `task_claims` (
`claim_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`task_id` INT NOT NULL,
`userid` INT NOT NULL,
`last_updated_table_version` INT NOT NULL,
`description` TEXT CHARACTER SET utf8
);",
	1,
	"\mcoop\TaskClaimsUpgrader"
);

?>