2023-11-03 20:25:23 +03:00
|
|
|
<?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
|
|
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
|
2023-11-29 12:24:09 +03:00
|
|
|
class Migration_Create_blocked_periods_table extends EA_Migration
|
|
|
|
{
|
2023-11-03 20:25:23 +03:00
|
|
|
/**
|
|
|
|
* Upgrade method.
|
|
|
|
*/
|
2024-12-19 21:13:51 +03:00
|
|
|
public function up(): void
|
2023-11-03 20:25:23 +03:00
|
|
|
{
|
2023-11-29 12:24:09 +03:00
|
|
|
if (!$this->db->table_exists('blocked_periods')) {
|
2023-11-03 20:25:23 +03:00
|
|
|
$this->dbforge->add_field([
|
|
|
|
'id' => [
|
|
|
|
'type' => 'INT',
|
|
|
|
'constraint' => 11,
|
2023-12-22 13:35:41 +03:00
|
|
|
'auto_increment' => true,
|
2023-11-03 20:25:23 +03:00
|
|
|
],
|
|
|
|
'create_datetime' => [
|
|
|
|
'type' => 'DATETIME',
|
2023-12-22 13:35:41 +03:00
|
|
|
'null' => true,
|
2023-11-03 20:25:23 +03:00
|
|
|
],
|
|
|
|
'update_datetime' => [
|
|
|
|
'type' => 'DATETIME',
|
2023-12-22 13:35:41 +03:00
|
|
|
'null' => true,
|
2023-11-03 20:25:23 +03:00
|
|
|
],
|
|
|
|
'name' => [
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
'constraint' => '256',
|
2023-12-22 13:35:41 +03:00
|
|
|
'null' => true,
|
2023-11-03 20:25:23 +03:00
|
|
|
],
|
|
|
|
'start_datetime' => [
|
|
|
|
'type' => 'DATETIME',
|
2023-12-22 13:35:41 +03:00
|
|
|
'null' => true,
|
2023-11-03 20:25:23 +03:00
|
|
|
],
|
|
|
|
'end_datetime' => [
|
|
|
|
'type' => 'DATETIME',
|
2023-12-22 13:35:41 +03:00
|
|
|
'null' => true,
|
2023-11-03 20:25:23 +03:00
|
|
|
],
|
2023-11-17 11:37:38 +03:00
|
|
|
'notes' => [
|
2023-11-03 20:25:23 +03:00
|
|
|
'type' => 'TEXT',
|
2023-12-22 13:35:41 +03:00
|
|
|
'null' => true,
|
|
|
|
],
|
2023-11-03 20:25:23 +03:00
|
|
|
]);
|
|
|
|
|
2023-11-29 12:24:09 +03:00
|
|
|
$this->dbforge->add_key('id', true);
|
2023-11-03 20:25:23 +03:00
|
|
|
|
2023-11-29 12:24:09 +03:00
|
|
|
$this->dbforge->create_table('blocked_periods', true, ['engine' => 'InnoDB']);
|
2023-11-03 20:25:23 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Downgrade method.
|
|
|
|
*/
|
2024-12-19 21:13:51 +03:00
|
|
|
public function down(): void
|
2023-11-03 20:25:23 +03:00
|
|
|
{
|
2023-11-29 12:24:09 +03:00
|
|
|
if ($this->db->table_exists('blocked_periods')) {
|
2023-11-03 20:25:23 +03:00
|
|
|
$this->dbforge->drop_table('blocked_periods');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|