HEX
Server: LiteSpeed
System: Linux s3604.bom1.stableserver.net 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User: dmstechonline (1480)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/dmstechonline/crm.dmstech.online/application/migrations/291_version_291.php
<?php

defined('BASEPATH') or exit('No direct script access allowed');

class Migration_Version_291 extends CI_Migration
{
    public function up()
    {
        if (!$this->db->field_exists('original_file_name', db_prefix() . 'project_files')) {
            $this->db->query('ALTER TABLE `' . db_prefix() . 'project_files` ADD `original_file_name` MEDIUMTEXT DEFAULT NULL AFTER `file_name`');
        }

        if (!$this->db->field_exists('submit_redirect_url', db_prefix() . 'web_to_lead')) {
            $this->db->query('ALTER TABLE `' . db_prefix() . 'web_to_lead` ADD `submit_redirect_url` MEDIUMTEXT DEFAULT NULL AFTER `success_submit_msg`');
        }

        if (!$this->db->field_exists('submit_action', db_prefix() . 'web_to_lead')) {
            $this->db->query('ALTER TABLE `' . db_prefix() . 'web_to_lead` ADD `submit_action` INT(2) DEFAULT 0 AFTER `success_submit_msg`');
        }

        if (!$this->db->field_exists('submit_redirect_url', db_prefix() . 'estimate_request_forms')) {
            $this->db->query('ALTER TABLE `' . db_prefix() . 'estimate_request_forms` ADD `submit_redirect_url` MEDIUMTEXT DEFAULT NULL AFTER `success_submit_msg`');
        }

        if (!$this->db->field_exists('submit_action', db_prefix() . 'estimate_request_forms')) {
            $this->db->query('ALTER TABLE `' . db_prefix() . 'estimate_request_forms` ADD `submit_action` INT(2) DEFAULT 0 AFTER `success_submit_msg`');
        }

        $this->db->where('original_file_name IS NULL');
        $this->db->set('original_file_name', 'file_name', false);
        $this->db->update('project_files');
    }
}