summaryrefslogtreecommitdiff
path: root/common/tables/task_dividend_credits.php
diff options
context:
space:
mode:
Diffstat (limited to 'common/tables/task_dividend_credits.php')
-rw-r--r--common/tables/task_dividend_credits.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/common/tables/task_dividend_credits.php b/common/tables/task_dividend_credits.php
new file mode 100644
index 0000000..d6a0ce7
--- /dev/null
+++ b/common/tables/task_dividend_credits.php
@@ -0,0 +1,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"
+);
+
+?>