From 61d1aa04d8d44b17bfe6dace90088669fc6c3df8 Mon Sep 17 00:00:00 2001 From: Kyle McFarland Date: Wed, 31 Jan 2018 00:51:07 -0600 Subject: Initial import * Registration system's almost done * Just part way through implementing tasks So not much done yet, but it's a start. --- common/tables/dividend_credits.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 common/tables/dividend_credits.php (limited to 'common/tables/dividend_credits.php') diff --git a/common/tables/dividend_credits.php b/common/tables/dividend_credits.php new file mode 100644 index 0000000..2f80ec0 --- /dev/null +++ b/common/tables/dividend_credits.php @@ -0,0 +1,36 @@ +conn->exec("ALTER TABLE dividend_ 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 = "dividend_credits"; + //$this->upgrade_method_names[2] = "from_1_to_2"; + } +} + +$dividend_credits_table_decl = new SimpleTableDecl( + "dividend_credits", + array( + "dividend_credits_ensure" => "INSERT IGNORE INTO dividend_credits (userid, year, credits, last_updated_table_version) VALUES (:userid, :year, 0, :table_ver)", + "add_to_dividend_credits" => "UPDATE dividend_credits SET credits=credits + :amount WHERE userid=:userid AND year=:year", + "remove_from_dividend_credits" => "UPDATE dividend_credits SET credits=credits - :amount WHERE userid=:userid AND year=:year", + "set_dividend_credits" => "UPDATE dividend_credits SET credits=:amount WHERE userid=:userid AND year=:year" + ), + "CREATE TABLE `dividend_credits` ( +`userid` INT NOT NULL, +`year` INT NOT NULL, +`credits` BIGINT NOT NULL, +`last_updated_table_version` INT NOT NULL, +PRIMARY KEY (`userid`, `year`) +);", + 1, + "\mcoop\DividendCreditsUpgrader" +); + -- cgit v1.1