26 lines
1022 B
PHP
26 lines
1022 B
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Migration_Add_pr_applicant extends CI_Migration
|
|
{
|
|
public function up()
|
|
{
|
|
if (!$this->db->field_exists('applicant_is_creator', 'purchase_requests')) {
|
|
$this->db->query("ALTER TABLE purchase_requests ADD applicant_is_creator TINYINT(1) NOT NULL DEFAULT 1 AFTER requested_by");
|
|
}
|
|
if (!$this->db->field_exists('applicant_name', 'purchase_requests')) {
|
|
$this->db->query("ALTER TABLE purchase_requests ADD applicant_name VARCHAR(150) NULL AFTER applicant_is_creator");
|
|
}
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
if ($this->db->field_exists('applicant_name', 'purchase_requests')) {
|
|
$this->db->query('ALTER TABLE purchase_requests DROP COLUMN applicant_name');
|
|
}
|
|
if ($this->db->field_exists('applicant_is_creator', 'purchase_requests')) {
|
|
$this->db->query('ALTER TABLE purchase_requests DROP COLUMN applicant_is_creator');
|
|
}
|
|
}
|
|
}
|