7 use Phinx\Migration\AbstractMigration;
15 public function up() {
18 $exists = $this->hasTable(
"cu_scheduledtxn");
19 print_r($exists,
true);
23 CREATE TABLE cu_scheduledtxn ( 25 cu varchar(10) NOT NULL, 27 feature_code varchar(10) NOT NULL, 28 user_id integer NOT NULL, 29 create_date timestamp without time zone, 31 approved_date timestamp without time zone, 36 next_trigger_date date, 37 interval_count smallint, 38 failure_count smallint, 40 repeating_parameters varchar, 43 $sqlRs = $this->query($sql);
46 $sql =
"CREATE SEQUENCE cu_scheduledtxn_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1";
47 $sqlRs = $this->query($sql);
50 $sql =
"ALTER SEQUENCE cu_scheduledtxn_id_seq OWNED BY cu_scheduledtxn.id";
51 $sqlRs = $this->query($sql);
54 $sql =
"ALTER TABLE ONLY cu_scheduledtxn ALTER COLUMN id SET DEFAULT nextval('cu_scheduledtxn_id_seq'::regclass)";
55 $sqlRs = $this->query($sql);
58 $sql =
"ALTER TABLE ONLY cu_scheduledtxn ADD CONSTRAINT cu_scheduledtxn_pkey PRIMARY KEY (id)";
59 $sqlRs = $this->query($sql);
62 $cuList = $this->fetchAll(
'SELECT cu FROM cuadmin');
63 for ( $i = 0; $i < count( $cuList ); $i++ ) {
64 $cu = strtolower( trim( $cuList[$i][
"cu"] ) );
67 if ($this->hasTable(
"{$cu}memorizedhdr")) {
68 $this->dropTable(
"{$cu}memorizedhdr");
70 if ($this->hasTable(
"{$cu}memorizeddtl")) {
71 $this->dropTable(
"{$cu}memorizeddtl");
82 public function down() {
84 $this->dropTable(
"cu_scheduledtxn");
87 $cuList = $this->fetchAll(
'SELECT cu FROM cuadmin');
88 for ( $i = 0; $i < count( $cuList ); $i++ ) {
89 $cu = strtolower( trim( $cuList[$i][
"cu"] ) );
92 if ($this->hasTable(
"{$cu}memorizedhdr")) {
93 $this->dropTable(
"{$cu}memorizedhdr");
95 if ($this->hasTable(
"{$cu}memorizeddtl")) {
96 $this->dropTable(
"{$cu}memorizeddtl");