Odyssey
2018053000_eStatementUpdate.php
1 <?php
2 /**
3  * Notes:
4  * 1. Anything complicated needs to be done with SQL.
5  * 2. Always have a check to know if the migration needs to occur (up or down).
6  * 3. Use up() and down(), not change(), because of the SQL
7  */
8 use Phinx\Migration\AbstractMigration;
9 
10 class eStatementUpdate extends AbstractMigration {
11  public function up() {
12  // get the list of credit unions
13  $tableName = "cucmsdocs";
14 
15  if ($this->hasTable($tableName)) {
16  // check for specific docsid 1: Start Disclosure
17  $docs = $this->fetchRow("SELECT * FROM cucmsdocs WHERE docsid = 1");
18  if ($docs) {
19  $this->query("UPDATE cucmsdocs SET docsdesc='eStatement Start Disclosure' WHERE docsid = 1");
20  } else {
21  $this->query("INSERT INTO cucmsdocs VALUES (1, 'esTermsStart', 'eStatement Start Disclosure', 1, ' ', 'Start e-Statements', 'Y', 'T', 'e-Statements', 'Products', 25, NULL, NULL)");
22  }
23 
24  // check for specific docsid 8: Stop Disclosure
25  $docs = $this->fetchRow("SELECT * FROM cucmsdocs WHERE docsid = 8");
26  if ($docs) {
27  $this->query("UPDATE cucmsdocs SET docsdesc='eStatement Stop Disclosure' WHERE docsid = 8");
28  } else {
29  $this->query("INSERT INTO cucmsdocs VALUES (8, 'esTermsStop', 'eStatement Stop Disclosure', 1, ' ', 'Stop e-Statements', 'Y', 'T', 'e-Statements', 'Products', 30, NULL, NULL)");
30  }
31 
32  // check for specific docsid 11: Notice
33  $docs = $this->fetchRow("SELECT * FROM cucmsdocs WHERE docsid = 11");
34  if ($docs) {
35  $this->query("UPDATE cucmsdocs SET docsdesc='eStatement Screen Message' WHERE docsid = 11");
36  } else {
37  $this->query("INSERT INTO cucmsdocs VALUES (11, 'esNotice', 'eStatement Screen Message', 2, 'Y', 'E-Statement Message', ' ', 'D', 'e-Statement Notice', 'Products', 35, NULL, NULL)");
38  }
39  }
40  }
41 
42  public function down() {
43 
44  }
45 }