diff options
author | Kyle McFarland <tfkyle@gmail.com> | 2018-01-31 00:51:07 -0600 |
---|---|---|
committer | Kyle McFarland <tfkyle@gmail.com> | 2018-01-31 00:51:07 -0600 |
commit | 61d1aa04d8d44b17bfe6dace90088669fc6c3df8 (patch) | |
tree | 7ede15c880e4c41a18cded46fe6d03fb2dc4543b /common/tables/tasks.php | |
download | mcoop-61d1aa04d8d44b17bfe6dace90088669fc6c3df8.zip mcoop-61d1aa04d8d44b17bfe6dace90088669fc6c3df8.tar.gz mcoop-61d1aa04d8d44b17bfe6dace90088669fc6c3df8.tar.bz2 |
* Registration system's almost done
* Just part way through implementing tasks
So not much done yet, but it's a start.
Diffstat (limited to 'common/tables/tasks.php')
-rw-r--r-- | common/tables/tasks.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/common/tables/tasks.php b/common/tables/tasks.php new file mode 100644 index 0000000..af754d2 --- /dev/null +++ b/common/tables/tasks.php @@ -0,0 +1,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?) +?> |