summaryrefslogtreecommitdiff
path: root/common/tables/tasks.php
blob: af754d272bd52736e5fe4f0c0e3b4baa47d02c6c (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
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace mcoop;
require_once("common/db_classes.php");

class TasksUpgrader extends BaseIncrementalTableUpgrader {
	function from_1_to_2() {
		//$this->conn->exec("ALTER TABLE tasks ADD COLUMN (test BOOL)");
		// No actual changes in this one, it was just to make sure the upgrader paths were working
	}

	function __construct($conn) {
		$this->conn = $conn;
		$this->table_name = "tasks";
		//$this->upgrade_method_names[2] = "from_1_to_2";
	}
}

$tasks_table_decl = new SimpleTableDecl(
	"tasks",
	array(
		"create_task" => "INSERT INTO tasks (admin_userid, last_updated_table_version, title, description) VALUES (:userid, :table_ver, :title, :desc)",
		// TODO: dynamically generating these queries based on what fields are modified instead of statically would be a good idea
		"update_task_title" => "UPDATE tasks SET title=:title WHERE taskid=:taskid",
		"update_task_td" => "UPDATE tasks SET title=:title, description=:desc WHERE taskid=:taskid",
		"update_task_desc" => "UPDATE tasks SET description=:description WHERE taskid=:taskid",
		"get_all_tasks_simple" => "SELECT taskid, admin_userid, last_updated_table_version, title, state FROM tasks",
		"get_all_tasks" => "SELECT * FROM tasks"
	),
	"CREATE TABLE `tasks` (
`taskid` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`admin_userid` INT NOT NULL,
`last_updated_table_version` INT NOT NULL,
`title` TEXT CHARACTER SET utf8,
`description` TEXT CHARACTER SET utf8,
`state` ENUM ('open', 'closed') NOT NULL DEFAULT 'open'
);",
	1,
	"\mcoop\TasksUpgrader"
);

// TODO: tables for comments both on tasks and task claims would be a good idea (and probably necessary)

// TODO: should either title be unique or maybe have an extra text task id kind of like bugzilla aliases?
// TODO: need a claims table, and a table listing dividend credits available for each task, also a notification table for the task admin so they know when someone wants to add dividend credits to a closed task so they can reopen the task if deemed appropriate (also comments like any bugtracker?)
?>