<?php

use Phalcon\Mvc\Model\Migration;

class CreateReqUmUserEmailMigration_474 extends Migration {
    public function up()
    {
        self::$connection->execute("
            CREATE TABLE IF NOT EXISTS jaga.req_um_user_email (
                id serial NOT NULL PRIMARY KEY,
                um_id integer NOT NULL,
                old_value varchar(255) NOT NULL,
                new_value varchar(255) NOT NULL,
                verif_code varchar(255) NOT NULL,
                status smallint NOT NULL DEFAULT(0),
                created_at timestamp(6) without time zone DEFAULT now(),
                verified_at timestamp(6) without time zone,
                deleted_at timestamp(6) without time zone
            );
        ");

        self::$connection->execute('create index req_um_user_email_verif_code_idx on jaga.req_um_user_email (verif_code);');
    }

    public function down()
    {
        self::$connection->execute("DROP TABLE IF EXISTS jaga.req_um_user_email");
    }
}
