diff --git a/application/config/migration.php b/application/config/migration.php index 67f170a7..78e384e4 100755 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -37,7 +37,7 @@ $config['migration_table'] = 'ea_migrations'; | be upgraded / downgraded to. | */ -$config['migration_version'] = 17; // current +$config['migration_version'] = 18; // current /* diff --git a/application/migrations/018_add_timezone_columns.php b/application/migrations/018_add_timezone_columns.php new file mode 100644 index 00000000..d02d1a39 --- /dev/null +++ b/application/migrations/018_add_timezone_columns.php @@ -0,0 +1,40 @@ + + * @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`; + '); + } +} diff --git a/assets/sql/data.sql b/assets/sql/data.sql index 02d109cc..1fcb2f11 100644 --- a/assets/sql/data.sql +++ b/assets/sql/data.sql @@ -27,4 +27,4 @@ VALUES ('require_phone_number', '1'), ('api_token', ''); -INSERT INTO `ea_migrations` VALUES ('16'); +INSERT INTO `ea_migrations` VALUES ('18'); diff --git a/assets/sql/structure.sql b/assets/sql/structure.sql index 567f4a1f..c65b30df 100755 --- a/assets/sql/structure.sql +++ b/assets/sql/structure.sql @@ -6,6 +6,7 @@ CREATE TABLE IF NOT EXISTS `ea_appointments` ( `book_datetime` DATETIME, `start_datetime` DATETIME, `end_datetime` DATETIME, + `timezone` VARCHAR(256), `location` TEXT, `notes` TEXT, `hash` TEXT, @@ -24,9 +25,9 @@ CREATE TABLE IF NOT EXISTS `ea_appointments` ( CREATE TABLE IF NOT EXISTS `ea_consents` ( `id` INT(11) NOT NULL AUTO_INCREMENT, - `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP - ON UPDATE CURRENT_TIMESTAMP, `created` TIMESTAMP, + `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + ON UPDATE CURRENT_TIMESTAMP, `first_name` VARCHAR(256), `last_name` VARCHAR(256), `email` VARCHAR(512), @@ -131,6 +132,7 @@ CREATE TABLE IF NOT EXISTS `ea_users` ( `state` VARCHAR(128), `zip_code` VARCHAR(64), `notes` TEXT, + `timezone` VARCHAR(256), `id_roles` INT(11) NOT NULL, PRIMARY KEY (`id`), KEY `id_roles` (`id_roles`)