mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-15 04:22:25 +03:00
62 lines
1.8 KiB
PHP
62 lines
1.8 KiB
PHP
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Easy!Appointments - Online Appointment Scheduler
|
|
*
|
|
* @package EasyAppointments
|
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
|
* @copyright Copyright (c) Alex Tselegidis
|
|
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
|
|
* @link https://easyappointments.org
|
|
* @since v1.4.0
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
class Migration_Create_appointment_location_column extends EA_Migration {
|
|
/**
|
|
* Upgrade method.
|
|
*/
|
|
public function up()
|
|
{
|
|
if ( ! $this->db->field_exists('location', 'appointments'))
|
|
{
|
|
$fields = [
|
|
'location' => [
|
|
'type' => 'TEXT',
|
|
'null' => TRUE,
|
|
'after' => 'end_datetime'
|
|
]
|
|
];
|
|
|
|
$this->dbforge->add_column('appointments', $fields);
|
|
}
|
|
|
|
if ( ! $this->db->field_exists('location', 'services'))
|
|
{
|
|
$fields = [
|
|
'location' => [
|
|
'type' => 'TEXT',
|
|
'null' => TRUE,
|
|
'after' => 'description'
|
|
]
|
|
];
|
|
|
|
$this->dbforge->add_column('services', $fields);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Downgrade method.
|
|
*/
|
|
public function down()
|
|
{
|
|
if ($this->db->field_exists('location', 'appointments'))
|
|
{
|
|
$this->dbforge->drop_column('appointments', 'location');
|
|
}
|
|
|
|
if ($this->db->field_exists('location', 'services'))
|
|
{
|
|
$this->dbforge->drop_column('services', 'location');
|
|
}
|
|
}
|
|
}
|