Added timezone fields to the database (#313).

This commit is contained in:
Alex Tselegidis 2020-03-29 12:47:57 +02:00
parent 12f6833ca5
commit 3d0d1f2005
4 changed files with 46 additions and 4 deletions

View file

@ -37,7 +37,7 @@ $config['migration_table'] = 'ea_migrations';
| be upgraded / downgraded to. | be upgraded / downgraded to.
| |
*/ */
$config['migration_version'] = 17; // current $config['migration_version'] = 18; // current
/* /*

View file

@ -0,0 +1,40 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/* ----------------------------------------------------------------------------
* Easy!Appointments - Open Source Web Scheduler
*
* @package EasyAppointments
* @author A.Tselegidis <alextselegidis@gmail.com>
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
* @link http://easyappointments.org
* @since v1.4.0
* ---------------------------------------------------------------------------- */
class Migration_Add_add_timezone_columns extends CI_Migration {
public function up()
{
$this->db->query('
ALTER TABLE `ea_appointments`
ADD `timezone` VARCHAR(256) NULL AFTER `end_datetime`;
');
$this->db->query('
ALTER TABLE `ea_users`
ADD `timezone` VARCHAR(256) NULL AFTER `notes`;
');
}
public function down()
{
$this->db->query('
ALTER TABLE `ea_appointments`
DROP COLUMN `timezone`;
');
$this->db->query('
ALTER TABLE `ea_users`
DROP COLUMN `timezone`;
');
}
}

View file

@ -27,4 +27,4 @@ VALUES
('require_phone_number', '1'), ('require_phone_number', '1'),
('api_token', ''); ('api_token', '');
INSERT INTO `ea_migrations` VALUES ('16'); INSERT INTO `ea_migrations` VALUES ('18');

View file

@ -6,6 +6,7 @@ CREATE TABLE IF NOT EXISTS `ea_appointments` (
`book_datetime` DATETIME, `book_datetime` DATETIME,
`start_datetime` DATETIME, `start_datetime` DATETIME,
`end_datetime` DATETIME, `end_datetime` DATETIME,
`timezone` VARCHAR(256),
`location` TEXT, `location` TEXT,
`notes` TEXT, `notes` TEXT,
`hash` TEXT, `hash` TEXT,
@ -24,9 +25,9 @@ CREATE TABLE IF NOT EXISTS `ea_appointments` (
CREATE TABLE IF NOT EXISTS `ea_consents` ( CREATE TABLE IF NOT EXISTS `ea_consents` (
`id` INT(11) NOT NULL AUTO_INCREMENT, `id` INT(11) NOT NULL AUTO_INCREMENT,
`created` TIMESTAMP,
`modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP, ON UPDATE CURRENT_TIMESTAMP,
`created` TIMESTAMP,
`first_name` VARCHAR(256), `first_name` VARCHAR(256),
`last_name` VARCHAR(256), `last_name` VARCHAR(256),
`email` VARCHAR(512), `email` VARCHAR(512),
@ -131,6 +132,7 @@ CREATE TABLE IF NOT EXISTS `ea_users` (
`state` VARCHAR(128), `state` VARCHAR(128),
`zip_code` VARCHAR(64), `zip_code` VARCHAR(64),
`notes` TEXT, `notes` TEXT,
`timezone` VARCHAR(256),
`id_roles` INT(11) NOT NULL, `id_roles` INT(11) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `id_roles` (`id_roles`) KEY `id_roles` (`id_roles`)