2020-04-22 22:48:56 +03:00
|
|
|
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
2019-06-08 16:56:38 +03:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
2022-01-18 15:05:42 +03:00
|
|
|
* Easy!Appointments - Online Appointment Scheduler
|
2019-06-08 16:56:38 +03:00
|
|
|
*
|
|
|
|
* @package EasyAppointments
|
|
|
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
2021-12-18 19:43:45 +03:00
|
|
|
* @copyright Copyright (c) Alex Tselegidis
|
|
|
|
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
|
|
|
|
* @link https://easyappointments.org
|
2019-06-08 16:56:38 +03:00
|
|
|
* @since v1.4.0
|
|
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
|
2023-11-29 12:24:09 +03:00
|
|
|
class Migration_Create_appointment_location_column extends EA_Migration
|
|
|
|
{
|
2020-04-22 22:48:56 +03:00
|
|
|
/**
|
|
|
|
* Upgrade method.
|
|
|
|
*/
|
2019-06-08 16:56:38 +03:00
|
|
|
public function up()
|
|
|
|
{
|
2023-11-29 12:24:09 +03:00
|
|
|
if (!$this->db->field_exists('location', 'appointments')) {
|
2022-03-29 11:35:50 +03:00
|
|
|
$fields = [
|
|
|
|
'location' => [
|
|
|
|
'type' => 'TEXT',
|
2023-11-29 12:24:09 +03:00
|
|
|
'null' => true,
|
2022-03-29 11:35:50 +03:00
|
|
|
'after' => 'end_datetime'
|
|
|
|
]
|
|
|
|
];
|
2019-06-08 17:57:09 +03:00
|
|
|
|
2022-03-29 11:35:50 +03:00
|
|
|
$this->dbforge->add_column('appointments', $fields);
|
|
|
|
}
|
|
|
|
|
2023-11-29 12:24:09 +03:00
|
|
|
if (!$this->db->field_exists('location', 'services')) {
|
2022-03-29 11:35:50 +03:00
|
|
|
$fields = [
|
|
|
|
'location' => [
|
|
|
|
'type' => 'TEXT',
|
2023-11-29 12:24:09 +03:00
|
|
|
'null' => true,
|
2022-03-29 11:35:50 +03:00
|
|
|
'after' => 'description'
|
|
|
|
]
|
|
|
|
];
|
|
|
|
|
|
|
|
$this->dbforge->add_column('services', $fields);
|
|
|
|
}
|
2019-06-08 16:56:38 +03:00
|
|
|
}
|
|
|
|
|
2020-04-22 22:48:56 +03:00
|
|
|
/**
|
|
|
|
* Downgrade method.
|
|
|
|
*/
|
2019-06-08 16:56:38 +03:00
|
|
|
public function down()
|
|
|
|
{
|
2023-11-29 12:24:09 +03:00
|
|
|
if ($this->db->field_exists('location', 'appointments')) {
|
2022-03-29 11:35:50 +03:00
|
|
|
$this->dbforge->drop_column('appointments', 'location');
|
|
|
|
}
|
2019-06-08 17:57:09 +03:00
|
|
|
|
2023-11-29 12:24:09 +03:00
|
|
|
if ($this->db->field_exists('location', 'services')) {
|
2022-03-29 11:35:50 +03:00
|
|
|
$this->dbforge->drop_column('services', 'location');
|
|
|
|
}
|
2019-06-08 16:56:38 +03:00
|
|
|
}
|
|
|
|
}
|