Odyssey
2018022200_vendorCodeChange.php
1 <?php
2 /* Notes:
3  * 1. Anything complicated needs to be done with SQL.
4  * 2. Always have a check to know if the migration needs to occur (up or down).
5  * 3. Use up() and down(), not change(), because of the SQL
6  */
7 use Phinx\Migration\AbstractMigration;
8 
9 class VendorCodeChange extends AbstractMigration {
10 
11  /* This is the process for moving forward. We are re-creating the table so if there is
12  * existing data will need to create a temporary table, copy the data, drop the old table,
13  * rename the temporary table.
14  */
15  public function up() {
16  // Update cuvendor records
17  $this->query("update cuvendors set vendor = 'CUPRODIGY', venddesc = 'CUPRODIGY', vendvar = 'CUPRODIGY' where vendor = 'CUDP'");
18 
19  // Update cuinfo records
20  $this->query("update cuinfo set vendor = 'CUPRODIGY' where vendor = 'CUDP'");
21  }
22 
23 }