easyappointments/application/migrations/018_add_timezone_to_users.php

43 lines
1.2 KiB
PHP
Raw Normal View History

<?php defined('BASEPATH') or exit('No direct script access allowed');
2014-01-04 19:35:20 +02:00
2015-07-20 22:41:24 +03:00
/* ----------------------------------------------------------------------------
2022-01-18 15:05:42 +03:00
* Easy!Appointments - Online Appointment Scheduler
*
2015-07-20 22:41:24 +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
* @since v1.4.0
2015-07-20 22:41:24 +03:00
* ---------------------------------------------------------------------------- */
class Migration_Add_timezone_to_users extends EA_Migration
{
/**
* Upgrade method.
*/
2024-12-19 21:13:51 +03:00
public function up(): void
{
if (!$this->db->field_exists('timezone', 'users')) {
$fields = [
'timezone' => [
'type' => 'VARCHAR',
'constraint' => '256',
'default' => 'UTC',
'after' => 'notes',
],
];
$this->dbforge->add_column('users', $fields);
}
}
2014-01-04 19:35:20 +02:00
/**
* Downgrade method.
*/
2024-12-19 21:13:51 +03:00
public function down(): void
{
$this->dbforge->drop_column('users', 'timezone');
}
}