7 use Phinx\Migration\AbstractMigration;
9 class Tron extends AbstractMigration
20 $tableExists = $this->hasTable( $name );
22 if ( !$tableExists ) {
24 print
"Creating table $name\n";
27 $sql =
"CREATE TABLE cutronab ( 28 runslot character varying(10) NOT NULL, 29 cu character(10) NOT NULL, 30 accountnumber character(12) NOT NULL, 31 accounttype character(25) NOT NULL, 32 certnumber integer NOT NULL, 33 deposittype character(1) NOT NULL, 34 description character varying(255) NOT NULL, 35 amount numeric(11,2) NOT NULL, 36 ytdinterest numeric(11,2) NOT NULL, 37 lastyrinterest numeric(11,2), 38 available numeric(11,2), 39 micraccount character(17) 43 $rows = $this->query( $sql );
46 $sql =
"CREATE UNIQUE INDEX cutronab_idx01 ON cutronab USING btree (runslot, cu, accountnumber, accounttype, certnumber)";
47 $rows = $this->query( $sql );
51 $tableExists = $this->hasTable( $name );
53 if ( !$tableExists ) {
55 print
"Creating table $name\n";
58 $sql =
"CREATE TABLE cutronah ( 59 runslot character varying(10) NOT NULL, 60 cu character(10) NOT NULL, 61 accountnumber character(12) NOT NULL, 62 accounttype character(25) NOT NULL, 63 certnumber integer NOT NULL, 64 tracenumber character(16) NOT NULL, 65 checknumber character(6), 66 date timestamp with time zone NOT NULL, 67 amount numeric(11,2) NOT NULL, 68 description character varying(255), 69 balance numeric(11,2) NOT NULL, 74 $rows = $this->query( $sql );
77 $sql =
"CREATE UNIQUE INDEX cutronah_idx01 ON cutronah USING btree (runslot, cu, accountnumber, accounttype, certnumber, tracenumber);";
78 $rows = $this->query( $sql );
82 $tableExists = $this->hasTable( $name );
84 if ( !$tableExists ) {
86 print
"Creating table $name\n";
89 $sql =
"CREATE TABLE cutronlb ( 90 runslot character varying(10) NOT NULL, 91 cu character(10) NOT NULL, 92 accountnumber character(12) NOT NULL, 93 loannumber character(25) NOT NULL, 94 currentbalance numeric(11,2) NOT NULL, 95 payoff numeric(11,2) NOT NULL, 96 paymentamount numeric(11,2) NOT NULL, 97 nextduedate timestamp with time zone, 98 description character varying(255), 100 creditlimit numeric(11,2), 101 ytdinterest numeric(11,2), 102 lastyrinterest numeric(11,2), 103 misc1 character varying(256), 105 lastpaymentdate timestamp with time zone 109 $rows = $this->query( $sql );
112 $sql =
"CREATE UNIQUE INDEX cutronlb_idx01 ON cutronlb USING btree (runslot, cu, accountnumber, loannumber)";
113 $rows = $this->query( $sql );
117 $tableExists = $this->hasTable( $name );
119 if ( !$tableExists ) {
121 print
"Creating table $name\n";
124 $sql =
"CREATE TABLE cutronlh ( 125 runslot character varying(10) NOT NULL, 126 cu character(10) NOT NULL, 127 accountnumber character(12) NOT NULL, 128 loannumber character(25) NOT NULL, 129 tracenumber character(16) NOT NULL, 130 date timestamp with time zone NOT NULL, 131 principleamount numeric(11,2) NOT NULL, 132 interestamount numeric(11,2) NOT NULL, 133 description character varying(255), 134 balance numeric(11,2), 135 sortkey character(16) 139 $rows = $this->query( $sql );
142 $sql =
"CREATE UNIQUE INDEX cutronlh_idx01 ON cutronlh USING btree (runslot, cu, accountnumber, loannumber, tracenumber)";
143 $rows = $this->query( $sql );
147 $tableExists = $this->hasTable( $name );
149 if ( !$tableExists ) {
151 print
"Creating table $name\n";
154 $sql =
"CREATE TABLE cutronus ( 155 runslot character varying(10) NOT NULL, 157 user_id integer NOT NULL, 158 shuffle double precision, 159 sched_id integer NOT NULL, 160 PRIMARY KEY (runslot, cu, user_id, sched_id) 164 $rows = $this->query( $sql );
173 public function down()
175 $sql =
"DROP TABLE IF EXISTS cutronab";
176 $rows = $this->query( $sql );
177 $sql =
"DROP TABLE IF EXISTS cutronah";
178 $rows = $this->query( $sql );
179 $sql =
"DROP TABLE IF EXISTS cutronlb";
180 $rows = $this->query( $sql );
181 $sql =
"DROP TABLE IF EXISTS cutronlh";
182 $rows = $this->query( $sql );
183 $sql =
"DROP TABLE IF EXISTS cutronus";
184 $rows = $this->query( $sql );