<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Migration_Version extends CI_Migration
{
    function __construct() {
        
        parent::__construct();
    }
    
    public function up()
    {
        $this->db->query("ALTER TABLE `cad_cadastro` ADD `data_hora_cadastro` DATETIME NOT NULL AFTER `descricao_pj`, ADD `timestamp_cadastro` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `data_hora_cadastro`;");
        $this->db->query("ALTER TABLE `cad_imovel` ADD `data_hora_imovel` DATETIME NOT NULL AFTER `visualizacoes`, ADD `timestamp_imovel` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `data_hora_imovel`;");
    }

    public function down()
    {
        $this->db->query("ALTER TABLE `cad_cadastro`
                          DROP `data_hora_cadastro`,
                          DROP `timestamp_cadastro`;");
  
        $this->db->query("ALTER TABLE `cad_imovel`
                          DROP `data_hora_imovel`,
                          DROP `timestamp_imovel`;");
    
    }
}