forked from mirrors/easyappointments
Refactor the migrations so that the complete DB change history is reproduced (fixes are also included).
This commit is contained in:
parent
39956c6b37
commit
f571fc9de8
21 changed files with 740 additions and 379 deletions
504
application/migrations/001_initial_database_structure.php
Normal file
504
application/migrations/001_initial_database_structure.php
Normal file
|
@ -0,0 +1,504 @@
|
|||
<?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_Initial_database_structure
|
||||
*
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
*/
|
||||
class Migration_Initial_database_structure extends CI_Migration {
|
||||
/**
|
||||
* Upgrade method.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$this->dbforge->add_field([
|
||||
'id' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
'auto_increment' => TRUE
|
||||
],
|
||||
'book_datetime' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => TRUE,
|
||||
],
|
||||
'start_datetime' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => TRUE,
|
||||
],
|
||||
'end_datetime' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => TRUE,
|
||||
],
|
||||
'notes' => [
|
||||
'type' => 'TEXT',
|
||||
'null' => TRUE,
|
||||
],
|
||||
'hash' => [
|
||||
'type' => 'TEXT',
|
||||
'null' => TRUE,
|
||||
],
|
||||
'is_unavailable' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => '4',
|
||||
'default' => '0'
|
||||
],
|
||||
'id_users_provider' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
'null' => TRUE
|
||||
],
|
||||
'id_users_customer' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
'null' => TRUE
|
||||
],
|
||||
'id_services' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
'null' => TRUE
|
||||
],
|
||||
'id_google_calendar' => [
|
||||
'type' => 'TEXT',
|
||||
'null' => TRUE
|
||||
],
|
||||
]);
|
||||
$this->dbforge->add_key('id', TRUE);
|
||||
$this->dbforge->add_key('id_users_provider');
|
||||
$this->dbforge->add_key('id_users_customer');
|
||||
$this->dbforge->add_key('id_services');
|
||||
$this->dbforge->create_table('ea_appointments', TRUE, ['engine' => 'InnoDB']);
|
||||
|
||||
$this->dbforge->add_field([
|
||||
'id' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
'auto_increment' => TRUE
|
||||
],
|
||||
'name' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '256',
|
||||
'null' => TRUE
|
||||
],
|
||||
'slug' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '256',
|
||||
'null' => TRUE
|
||||
],
|
||||
'is_admin' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => '4',
|
||||
'null' => TRUE
|
||||
],
|
||||
'appointments' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => '4',
|
||||
'null' => TRUE
|
||||
],
|
||||
'customers' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => '4',
|
||||
'null' => TRUE
|
||||
],
|
||||
'services' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => '4',
|
||||
'null' => TRUE
|
||||
],
|
||||
'users' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => '4',
|
||||
'null' => TRUE
|
||||
],
|
||||
'system_settings' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => '4',
|
||||
'null' => TRUE
|
||||
],
|
||||
'user_settings' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => '4',
|
||||
'null' => TRUE
|
||||
],
|
||||
]);
|
||||
$this->dbforge->add_key('id', TRUE);
|
||||
$this->dbforge->create_table('ea_roles', TRUE, ['engine' => 'InnoDB']);
|
||||
|
||||
$this->dbforge->add_field([
|
||||
'id_users_secretary' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
],
|
||||
'id_users_provider' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
]
|
||||
]);
|
||||
$this->dbforge->add_key('id_users_secretary', TRUE);
|
||||
$this->dbforge->add_key('id_users_provider', TRUE);
|
||||
$this->dbforge->create_table('ea_secretaries_providers', TRUE, ['engine' => 'InnoDB']);
|
||||
|
||||
$this->dbforge->add_field([
|
||||
'id' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
'auto_increment' => TRUE
|
||||
],
|
||||
'name' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '256',
|
||||
'null' => TRUE
|
||||
],
|
||||
'duration' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => '11',
|
||||
'null' => TRUE
|
||||
],
|
||||
'price' => [
|
||||
'type' => 'DECIMAL',
|
||||
'constraint' => '10,2',
|
||||
'null' => TRUE
|
||||
],
|
||||
'currency' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '32',
|
||||
'null' => TRUE
|
||||
],
|
||||
'description' => [
|
||||
'type' => 'TEXT',
|
||||
'null' => TRUE
|
||||
],
|
||||
'id_service_categories' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
'null' => TRUE
|
||||
],
|
||||
]);
|
||||
$this->dbforge->add_key('id', TRUE);
|
||||
$this->dbforge->add_key('id_service_categories');
|
||||
$this->dbforge->create_table('ea_services', TRUE, ['engine' => 'InnoDB']);
|
||||
|
||||
$this->dbforge->add_field([
|
||||
'id_users' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
],
|
||||
'id_services' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
]
|
||||
]);
|
||||
$this->dbforge->add_key('id_users', TRUE);
|
||||
$this->dbforge->add_key('id_services', TRUE);
|
||||
$this->dbforge->create_table('ea_services_providers', TRUE, ['engine' => 'InnoDB']);
|
||||
|
||||
$this->dbforge->add_field([
|
||||
'id' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
'auto_increment' => TRUE
|
||||
],
|
||||
'name' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '256',
|
||||
'null' => TRUE
|
||||
],
|
||||
'description' => [
|
||||
'type' => 'TEXT',
|
||||
'null' => TRUE
|
||||
],
|
||||
]);
|
||||
$this->dbforge->add_key('id', TRUE);
|
||||
$this->dbforge->add_key('id_service_categories');
|
||||
$this->dbforge->create_table('ea_service_categories', TRUE, ['engine' => 'InnoDB']);
|
||||
|
||||
$this->dbforge->add_field([
|
||||
'id' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
'auto_increment' => TRUE
|
||||
],
|
||||
'name' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '512',
|
||||
'null' => TRUE
|
||||
],
|
||||
'value' => [
|
||||
'type' => 'LONGTEXT',
|
||||
'null' => TRUE
|
||||
],
|
||||
]);
|
||||
$this->dbforge->add_key('id', TRUE);
|
||||
$this->dbforge->create_table('ea_settings', TRUE, ['engine' => 'InnoDB']);
|
||||
|
||||
$this->dbforge->add_field([
|
||||
'id' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
'auto_increment' => TRUE
|
||||
],
|
||||
'first_name' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '256',
|
||||
'null' => TRUE
|
||||
],
|
||||
'last_name' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '512',
|
||||
'null' => TRUE
|
||||
],
|
||||
'email' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '512',
|
||||
'null' => TRUE
|
||||
],
|
||||
'mobile_number' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '128',
|
||||
'null' => TRUE
|
||||
],
|
||||
'phone_number' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '128',
|
||||
'null' => TRUE
|
||||
],
|
||||
'address' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '256',
|
||||
'null' => TRUE
|
||||
],
|
||||
'city' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '256',
|
||||
'null' => TRUE
|
||||
],
|
||||
'state' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '128',
|
||||
'null' => TRUE
|
||||
],
|
||||
'zip_code' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '64',
|
||||
'null' => TRUE
|
||||
],
|
||||
'notes' => [
|
||||
'type' => 'TEXT',
|
||||
'null' => TRUE
|
||||
],
|
||||
'id_roles' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE
|
||||
],
|
||||
]);
|
||||
$this->dbforge->add_key('id', TRUE);
|
||||
$this->dbforge->add_key('id_roles');
|
||||
$this->dbforge->create_table('ea_users', TRUE, ['engine' => 'InnoDB']);
|
||||
|
||||
$this->dbforge->add_field([
|
||||
'id_users' => [
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => '20',
|
||||
'unsigned' => TRUE,
|
||||
],
|
||||
'username' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '256',
|
||||
'null' => TRUE
|
||||
],
|
||||
'password' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '512',
|
||||
'null' => TRUE
|
||||
],
|
||||
'salt' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '512',
|
||||
'null' => TRUE
|
||||
],
|
||||
'working_plan' => [
|
||||
'type' => 'TEXT',
|
||||
'null' => TRUE
|
||||
],
|
||||
'notifications' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => '4',
|
||||
'null' => TRUE
|
||||
],
|
||||
'google_sync' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => '4',
|
||||
'null' => TRUE
|
||||
],
|
||||
'google_token' => [
|
||||
'type' => 'TEXT',
|
||||
'null' => TRUE
|
||||
],
|
||||
'google_calendar' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '128',
|
||||
'null' => TRUE
|
||||
],
|
||||
'sync_past_days' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => '11',
|
||||
'null' => TRUE,
|
||||
'default' => '5'
|
||||
],
|
||||
'sync_future_days' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => '11',
|
||||
'null' => TRUE,
|
||||
'default' => '5'
|
||||
],
|
||||
]);
|
||||
$this->dbforge->add_key('id_users', TRUE);
|
||||
$this->dbforge->create_table('ea_user_settings', TRUE, ['engine' => 'InnoDB']);
|
||||
|
||||
$this->db->query('
|
||||
ALTER TABLE `ea_appointments`
|
||||
ADD CONSTRAINT `ea_appointments_ibfk_2` FOREIGN KEY (`id_users_customer`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `ea_appointments_ibfk_3` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `ea_appointments_ibfk_4` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
');
|
||||
|
||||
$this->db->query('
|
||||
ALTER TABLE `ea_secretaries_providers`
|
||||
ADD CONSTRAINT `fk_ea_secretaries_providers_1` FOREIGN KEY (`id_users_secretary`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `fk_ea_secretaries_providers_2` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
');
|
||||
|
||||
$this->db->query('
|
||||
ALTER TABLE `ea_services`
|
||||
ADD CONSTRAINT `ea_services_ibfk_1` FOREIGN KEY (`id_service_categories`) REFERENCES `ea_service_categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
');
|
||||
|
||||
$this->db->query('
|
||||
ALTER TABLE `ea_services_providers`
|
||||
ADD CONSTRAINT `ea_services_providers_ibfk_1` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `ea_services_providers_ibfk_2` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
');
|
||||
|
||||
$this->db->query('
|
||||
ALTER TABLE `ea_users`
|
||||
ADD CONSTRAINT `ea_users_ibfk_1` FOREIGN KEY (`id_roles`) REFERENCES `ea_roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
');
|
||||
|
||||
$this->db->query('
|
||||
ALTER TABLE `ea_user_settings`
|
||||
ADD CONSTRAINT `ea_user_settings_ibfk_1` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
');
|
||||
|
||||
$this->db->insert('ea_roles', [
|
||||
'name' => 'Administrator',
|
||||
'slug' => 'admin',
|
||||
'is_admin' => TRUE,
|
||||
'appointments' => 15,
|
||||
'customers' => 15,
|
||||
'services' => 15,
|
||||
'users' => 15,
|
||||
'system_settings' => 15,
|
||||
'user_settings' => 15,
|
||||
]);
|
||||
|
||||
$this->db->insert('ea_roles', [
|
||||
'name' => 'Provider',
|
||||
'slug' => 'provider',
|
||||
'is_admin' => FALSE,
|
||||
'appointments' => 15,
|
||||
'customers' => 15,
|
||||
'services' => 0,
|
||||
'users' => 0,
|
||||
'system_settings' => 0,
|
||||
'user_settings' => 15,
|
||||
]);
|
||||
|
||||
$this->db->insert('ea_roles', [
|
||||
'name' => 'Customer',
|
||||
'slug' => 'customer',
|
||||
'is_admin' => FALSE,
|
||||
'appointments' => 0,
|
||||
'customers' => 0,
|
||||
'services' => 0,
|
||||
'users' => 0,
|
||||
'system_settings' => 0,
|
||||
'user_settings' => 0,
|
||||
]);
|
||||
|
||||
$this->db->insert('ea_roles', [
|
||||
'name' => 'Secretary',
|
||||
'slug' => 'secretary',
|
||||
'is_admin' => FALSE,
|
||||
'appointments' => 15,
|
||||
'customers' => 15,
|
||||
'services' => 0,
|
||||
'users' => 0,
|
||||
'system_settings' => 0,
|
||||
'user_settings' => 15,
|
||||
]);
|
||||
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'company_working_plan',
|
||||
'value' => '{"monday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"tuesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"wednesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"thursday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"friday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"saturday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"sunday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]}}'
|
||||
]);
|
||||
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'book_advance_timeout',
|
||||
'value' => '30'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Downgrade method.
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `ea_appointments_ibfk_2`');
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `ea_appointments_ibfk_3`');
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `ea_appointments_ibfk_4`');
|
||||
$this->db->query('ALTER TABLE `ea_secretaries_providers` DROP FOREIGN KEY `fk_ea_secretaries_providers_1`');
|
||||
$this->db->query('ALTER TABLE `ea_secretaries_providers` DROP FOREIGN KEY `fk_ea_secretaries_providers_2`');
|
||||
$this->db->query('ALTER TABLE `ea_services_providers` DROP FOREIGN KEY `ea_services_providers_ibfk_1`');
|
||||
$this->db->query('ALTER TABLE `ea_services_providers` DROP FOREIGN KEY `ea_services_providers_ibfk_2`');
|
||||
$this->db->query('ALTER TABLE `ea_services` DROP FOREIGN KEY `ea_services_ibfk_1`');
|
||||
$this->db->query('ALTER TABLE `ea_users` DROP FOREIGN KEY `ea_users_ibfk_1`');
|
||||
$this->db->query('ALTER TABLE `ea_user_settings` DROP FOREIGN KEY `ea_user_settings_ibfk_1`');
|
||||
|
||||
$this->dbforge->drop_table('ea_appointments');
|
||||
$this->dbforge->drop_table('ea_roles');
|
||||
$this->dbforge->drop_table('ea_secretaries_providers');
|
||||
$this->dbforge->drop_table('ea_services');
|
||||
$this->dbforge->drop_table('ea_service_categories');
|
||||
$this->dbforge->drop_table('ea_services_providers');
|
||||
$this->dbforge->drop_table('ea_settings');
|
||||
$this->dbforge->drop_table('ea_user_settings');
|
||||
$this->dbforge->drop_table('ea_users');
|
||||
}
|
||||
}
|
|
@ -14,24 +14,10 @@
|
|||
/**
|
||||
* Class Migration_Add_google_analytics_setting
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Add_google_analytics_setting extends CI_Migration {
|
||||
/**
|
||||
* Migration_Add_google_analytics_setting constructor.
|
||||
*
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct($config = [])
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$this->load->model('settings_model');
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade method.
|
||||
*
|
||||
|
@ -39,14 +25,10 @@ class Migration_Add_google_analytics_setting extends CI_Migration {
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->settings_model->get_setting('google_analytics_code');
|
||||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->settings_model->set_setting('google_analytics_code', '');
|
||||
}
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'google_analytics_code',
|
||||
'value' => ''
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,6 +38,6 @@ class Migration_Add_google_analytics_setting extends CI_Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->settings_model->remove_setting('google_analytics_code');
|
||||
$this->db->delete('ea_settings', ['name' => 'google_analytics_code']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,21 +16,8 @@
|
|||
*
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Add_customer_notifications_setting extends CI_Migration {
|
||||
/**
|
||||
* Migration_Add_customer_notifications_setting constructor.
|
||||
*
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct($config = [])
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$this->load->model('settings_model');
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade method.
|
||||
*
|
||||
|
@ -38,14 +25,10 @@ class Migration_Add_customer_notifications_setting extends CI_Migration {
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->settings_model->get_setting('customer_notifications');
|
||||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->settings_model->set_setting('customer_notifications', '1');
|
||||
}
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'customer_notifications',
|
||||
'value' => '1'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,6 +38,6 @@ class Migration_Add_customer_notifications_setting extends CI_Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->settings_model->remove_setting('customer_notifications');
|
||||
$this->db->delete('ea_settings', ['name' => 'customer_notifications']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,25 +14,10 @@
|
|||
/**
|
||||
* Class Migration_Add_date_format_setting
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Add_date_format_setting extends CI_Migration {
|
||||
/**
|
||||
* Migration_Add_date_format_setting constructor.
|
||||
*
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct($config = [])
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$this->load->model('settings_model');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Upgrade method.
|
||||
*
|
||||
|
@ -40,14 +25,10 @@ class Migration_Add_date_format_setting extends CI_Migration {
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->settings_model->get_setting('date_format');
|
||||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->settings_model->set_setting('date_format', DATE_FORMAT_DMY);
|
||||
}
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'date_format',
|
||||
'value' => 'DMY'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,6 +38,6 @@ class Migration_Add_date_format_setting extends CI_Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->settings_model->remove_setting('date_format');
|
||||
$this->db->delete('ea_settings', ['name' => 'date_format']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,24 +14,10 @@
|
|||
/**
|
||||
* Class Migration_Add_require_captcha_setting
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Add_require_captcha_setting extends CI_Migration {
|
||||
/**
|
||||
* Migration_Add_require_captcha_setting constructor.
|
||||
*
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct($config = [])
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$this->load->model('settings_model');
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade method.
|
||||
*
|
||||
|
@ -39,14 +25,10 @@ class Migration_Add_require_captcha_setting extends CI_Migration {
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->settings_model->get_setting('require_captcha');
|
||||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->settings_model->set_setting('require_captcha', '1');
|
||||
}
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'require_captcha',
|
||||
'value' => '0'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,6 +38,6 @@ class Migration_Add_require_captcha_setting extends CI_Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->settings_model->remove_setting('require_captcha');
|
||||
$this->db->delete('ea_settings', ['name' => 'require_captcha']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,8 @@
|
|||
/**
|
||||
* Class Migration_Add_calendar_view_setting
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Add_calendar_view_setting extends CI_Migration {
|
||||
/**
|
||||
|
@ -48,7 +46,7 @@ class Migration_Add_calendar_view_setting extends CI_Migration {
|
|||
{
|
||||
if ($this->db->field_exists('calendar_view', 'ea_user_settings'))
|
||||
{
|
||||
$this->dbforge->drop_column('ea_user_settings', 'calendar_view_calendar');
|
||||
$this->dbforge->drop_column('ea_user_settings', 'calendar_view');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,14 +12,12 @@
|
|||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Class Migration_Add_service_availabilities_type
|
||||
* Class Migration_Add_availabilities_type_to_services_table
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Add_service_availabilities_type extends CI_Migration {
|
||||
class Migration_Add_availabilities_type_to_services_table extends CI_Migration {
|
||||
/**
|
||||
* Upgrade method.
|
||||
*/
|
|
@ -12,14 +12,12 @@
|
|||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Class Migration_Add_service_attendants_number
|
||||
* Class Migration_Add_attendants_number_to_services_table
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Add_service_attendants_number extends CI_Migration {
|
||||
class Migration_Add_attendants_number_to_services_table extends CI_Migration {
|
||||
/**
|
||||
* Upgrade method.
|
||||
*/
|
||||
|
@ -37,8 +35,6 @@ class Migration_Add_service_attendants_number extends CI_Migration {
|
|||
];
|
||||
|
||||
$this->dbforge->add_column('ea_services', $fields);
|
||||
|
||||
$this->db->update('ea_services', ['attendants_number' => '1']);
|
||||
}
|
||||
}
|
||||
|
|
@ -14,10 +14,8 @@
|
|||
/**
|
||||
* Class Migration_Change_column_types
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Change_column_types extends CI_Migration {
|
||||
/**
|
||||
|
@ -26,16 +24,16 @@ class Migration_Change_column_types extends CI_Migration {
|
|||
public function up()
|
||||
{
|
||||
// Drop table constraints.
|
||||
$this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_2');
|
||||
$this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_3');
|
||||
$this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_4');
|
||||
$this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY fk_ea_secretaries_providers_1');
|
||||
$this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY fk_ea_secretaries_providers_2');
|
||||
$this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY ea_services_providers_ibfk_1');
|
||||
$this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY ea_services_providers_ibfk_2');
|
||||
$this->db->query('ALTER TABLE ea_services DROP FOREIGN KEY ea_services_ibfk_1');
|
||||
$this->db->query('ALTER TABLE ea_users DROP FOREIGN KEY ea_users_ibfk_1');
|
||||
$this->db->query('ALTER TABLE ea_user_settings DROP FOREIGN KEY ea_user_settings_ibfk_1');
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `ea_appointments_ibfk_2`');
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `ea_appointments_ibfk_3`');
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `ea_appointments_ibfk_4`');
|
||||
$this->db->query('ALTER TABLE `ea_secretaries_providers` DROP FOREIGN KEY `fk_ea_secretaries_providers_1`');
|
||||
$this->db->query('ALTER TABLE `ea_secretaries_providers` DROP FOREIGN KEY `fk_ea_secretaries_providers_2`');
|
||||
$this->db->query('ALTER TABLE `ea_services_providers` DROP FOREIGN KEY `ea_services_providers_ibfk_1`');
|
||||
$this->db->query('ALTER TABLE `ea_services_providers` DROP FOREIGN KEY `ea_services_providers_ibfk_2`');
|
||||
$this->db->query('ALTER TABLE `ea_services` DROP FOREIGN KEY `ea_services_ibfk_1`');
|
||||
$this->db->query('ALTER TABLE `ea_users` DROP FOREIGN KEY `ea_users_ibfk_1`');
|
||||
$this->db->query('ALTER TABLE `ea_user_settings` DROP FOREIGN KEY `ea_user_settings_ibfk_1`');
|
||||
|
||||
// Appointments
|
||||
$fields = [
|
||||
|
@ -240,16 +238,16 @@ class Migration_Change_column_types extends CI_Migration {
|
|||
public function down()
|
||||
{
|
||||
// Drop table constraints.
|
||||
$this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_2');
|
||||
$this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_3');
|
||||
$this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_4');
|
||||
$this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY fk_ea_secretaries_providers_1');
|
||||
$this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY fk_ea_secretaries_providers_2');
|
||||
$this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY ea_services_providers_ibfk_1');
|
||||
$this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY ea_services_providers_ibfk_2');
|
||||
$this->db->query('ALTER TABLE ea_services DROP FOREIGN KEY ea_services_ibfk_1');
|
||||
$this->db->query('ALTER TABLE ea_users DROP FOREIGN KEY ea_users_ibfk_1');
|
||||
$this->db->query('ALTER TABLE ea_user_settings DROP FOREIGN KEY ea_user_settings_ibfk_1');
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `ea_appointments_ibfk_2`');
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `ea_appointments_ibfk_3`');
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `ea_appointments_ibfk_4`');
|
||||
$this->db->query('ALTER TABLE `ea_secretaries_providers` DROP FOREIGN KEY `fk_ea_secretaries_providers_1`');
|
||||
$this->db->query('ALTER TABLE `ea_secretaries_providers` DROP FOREIGN KEY `fk_ea_secretaries_providers_2`');
|
||||
$this->db->query('ALTER TABLE `ea_services_providers` DROP FOREIGN KEY `ea_services_providers_ibfk_1`');
|
||||
$this->db->query('ALTER TABLE `ea_services_providers` DROP FOREIGN KEY `ea_services_providers_ibfk_2`');
|
||||
$this->db->query('ALTER TABLE `ea_services` DROP FOREIGN KEY `ea_services_ibfk_1`');
|
||||
$this->db->query('ALTER TABLE `ea_users` DROP FOREIGN KEY `ea_users_ibfk_1`');
|
||||
$this->db->query('ALTER TABLE `ea_user_settings` DROP FOREIGN KEY `ea_user_settings_ibfk_1`');
|
||||
|
||||
// Appointments
|
||||
$fields = [
|
||||
|
@ -402,7 +400,7 @@ class Migration_Change_column_types extends CI_Migration {
|
|||
'auto_increment' => TRUE
|
||||
],
|
||||
'id_roles' => [
|
||||
'name' => 'id',
|
||||
'name' => 'id_roles',
|
||||
'type' => 'bigint',
|
||||
'constraint' => '20'
|
||||
]
|
||||
|
|
|
@ -14,37 +14,19 @@
|
|||
/**
|
||||
* Class Migration_Add_time_format_setting
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Add_time_format_setting extends CI_Migration {
|
||||
/**
|
||||
* Migration_Add_time_format_setting constructor.
|
||||
*
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct($config = [])
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$this->load->model('settings_model');
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade method.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->settings_model->get_setting('time_format');
|
||||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->settings_model->set_setting('time_format', 'regular');
|
||||
}
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'time_format',
|
||||
'value' => 'regular'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,6 +34,6 @@ class Migration_Add_time_format_setting extends CI_Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->settings_model->remove_setting('time_format');
|
||||
$this->db->delete('ea_settings', ['name' => 'time_format']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,30 +12,28 @@
|
|||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Class Migration_Remove_prefix_from_fkey_constraints
|
||||
* Class Migration_Remove_prefix_from_foreign_keys
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Remove_prefix_from_fkey_constraints extends CI_Migration {
|
||||
class Migration_Remove_prefix_from_foreign_keys extends CI_Migration {
|
||||
/**
|
||||
* Upgrade method.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// Drop table constraints.
|
||||
$this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_2');
|
||||
$this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_3');
|
||||
$this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY ea_appointments_ibfk_4');
|
||||
$this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY fk_ea_secretaries_providers_1');
|
||||
$this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY fk_ea_secretaries_providers_2');
|
||||
$this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY ea_services_providers_ibfk_1');
|
||||
$this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY ea_services_providers_ibfk_2');
|
||||
$this->db->query('ALTER TABLE ea_services DROP FOREIGN KEY ea_services_ibfk_1');
|
||||
$this->db->query('ALTER TABLE ea_users DROP FOREIGN KEY ea_users_ibfk_1');
|
||||
$this->db->query('ALTER TABLE ea_user_settings DROP FOREIGN KEY ea_user_settings_ibfk_1');
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `ea_appointments_ibfk_2`');
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `ea_appointments_ibfk_3`');
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `ea_appointments_ibfk_4`');
|
||||
$this->db->query('ALTER TABLE `ea_secretaries_providers` DROP FOREIGN KEY `fk_ea_secretaries_providers_1`');
|
||||
$this->db->query('ALTER TABLE `ea_secretaries_providers` DROP FOREIGN KEY `fk_ea_secretaries_providers_2`');
|
||||
$this->db->query('ALTER TABLE `ea_services_providers` DROP FOREIGN KEY `ea_services_providers_ibfk_1`');
|
||||
$this->db->query('ALTER TABLE `ea_services_providers` DROP FOREIGN KEY `ea_services_providers_ibfk_2`');
|
||||
$this->db->query('ALTER TABLE `ea_services` DROP FOREIGN KEY `ea_services_ibfk_1`');
|
||||
$this->db->query('ALTER TABLE `ea_users` DROP FOREIGN KEY `ea_users_ibfk_1`');
|
||||
$this->db->query('ALTER TABLE `ea_user_settings` DROP FOREIGN KEY `ea_user_settings_ibfk_1`');
|
||||
|
||||
// Add table constraints again without the "ea" prefix.
|
||||
$this->db->query('ALTER TABLE `ea_appointments`
|
||||
|
@ -87,16 +85,16 @@ class Migration_Remove_prefix_from_fkey_constraints extends CI_Migration {
|
|||
public function down()
|
||||
{
|
||||
// Drop table constraints.
|
||||
$this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY appointments_services');
|
||||
$this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY appointments_users_customer');
|
||||
$this->db->query('ALTER TABLE ea_appointments DROP FOREIGN KEY appointments_users_provider');
|
||||
$this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY secretaries_users_secretary');
|
||||
$this->db->query('ALTER TABLE ea_secretaries_providers DROP FOREIGN KEY secretaries_users_provider');
|
||||
$this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY services_providers_users_provider');
|
||||
$this->db->query('ALTER TABLE ea_services_providers DROP FOREIGN KEY services_providers_services');
|
||||
$this->db->query('ALTER TABLE ea_services DROP FOREIGN KEY services_service_categories');
|
||||
$this->db->query('ALTER TABLE ea_users DROP FOREIGN KEY users_roles');
|
||||
$this->db->query('ALTER TABLE ea_user_settings DROP FOREIGN KEY user_settings_users');
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `appointments_services`');
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `appointments_users_customer`');
|
||||
$this->db->query('ALTER TABLE `ea_appointments` DROP FOREIGN KEY `appointments_users_provider`');
|
||||
$this->db->query('ALTER TABLE `ea_secretaries_providers` DROP FOREIGN KEY `secretaries_users_secretary`');
|
||||
$this->db->query('ALTER TABLE `ea_secretaries_providers` DROP FOREIGN KEY `secretaries_users_provider`');
|
||||
$this->db->query('ALTER TABLE `ea_services_providers` DROP FOREIGN KEY `services_providers_users_provider`');
|
||||
$this->db->query('ALTER TABLE `ea_services_providers` DROP FOREIGN KEY `services_providers_services`');
|
||||
$this->db->query('ALTER TABLE `ea_services` DROP FOREIGN KEY `services_service_categories`');
|
||||
$this->db->query('ALTER TABLE `ea_users` DROP FOREIGN KEY `users_roles`');
|
||||
$this->db->query('ALTER TABLE `ea_user_settings` DROP FOREIGN KEY `user_settings_users`');
|
||||
|
||||
// Add table constraints again.
|
||||
$this->db->query('ALTER TABLE `ea_appointments`
|
133
application/migrations/012_create_consents_table.php
Normal file
133
application/migrations/012_create_consents_table.php
Normal file
|
@ -0,0 +1,133 @@
|
|||
<?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.3.2
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Class Migration_Create_consents_table
|
||||
*
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
*/
|
||||
class Migration_Create_consents_table extends CI_Migration {
|
||||
/**
|
||||
* Upgrade method.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'display_cookie_notice',
|
||||
'value' => '0'
|
||||
]);
|
||||
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'cookie_notice_content',
|
||||
'value' => 'Cookie notice content.'
|
||||
]);
|
||||
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'display_terms_and_conditions',
|
||||
'value' => '0'
|
||||
]);
|
||||
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'terms_and_conditions_content',
|
||||
'value' => 'Terms and conditions content.'
|
||||
]);
|
||||
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'display_privacy_policy',
|
||||
'value' => '0'
|
||||
]);
|
||||
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'privacy_policy_content',
|
||||
'value' => 'Privacy policy content.'
|
||||
]);
|
||||
|
||||
$this->dbforge->add_field([
|
||||
'id' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => 11,
|
||||
'auto_increment' => TRUE
|
||||
],
|
||||
'created' => [
|
||||
'type' => 'TIMESTAMP',
|
||||
'null' => TRUE
|
||||
],
|
||||
'modified' => [
|
||||
'type' => 'TIMESTAMP',
|
||||
'null' => TRUE
|
||||
],
|
||||
'first_name' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '256',
|
||||
'null' => TRUE,
|
||||
],
|
||||
'last_name' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '256',
|
||||
'null' => TRUE,
|
||||
],
|
||||
'email' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '512',
|
||||
'null' => TRUE,
|
||||
],
|
||||
'ip' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '256',
|
||||
'null' => TRUE,
|
||||
],
|
||||
'type' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '256',
|
||||
'null' => TRUE,
|
||||
],
|
||||
]);
|
||||
|
||||
$this->dbforge->add_key('id', TRUE);
|
||||
|
||||
$this->dbforge->create_table('ea_consents', TRUE, ['engine' => 'InnoDB']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Downgrade method.
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->db->delete('ea_settings', [
|
||||
'name' => 'display_cookie_notice'
|
||||
]);
|
||||
|
||||
$this->db->delete('ea_settings', [
|
||||
'name' => 'cookie_notice_content'
|
||||
]);
|
||||
|
||||
$this->db->delete('ea_settings', [
|
||||
'name' => 'display_terms_and_conditions'
|
||||
]);
|
||||
|
||||
$this->db->delete('ea_settings', [
|
||||
'name' => 'terms_and_conditions_content'
|
||||
]);
|
||||
|
||||
$this->db->delete('ea_settings', [
|
||||
'name' => 'display_privacy_policy'
|
||||
]);
|
||||
|
||||
$this->db->delete('ea_settings', [
|
||||
'name' => 'privacy_policy_content'
|
||||
]);
|
||||
|
||||
$this->dbforge->drop_table('ea_consents');
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
<?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.3.2
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Class Migration_Legal_contents
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Legal_contents extends CI_Migration {
|
||||
/**
|
||||
* Upgrade method.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$this->db->insert('ea_settings', ['name' => 'display_cookie_notice', 'value' => '0']);
|
||||
$this->db->insert('ea_settings', ['name' => 'cookie_notice_content', 'value' => 'Cookie notice content.']);
|
||||
$this->db->insert('ea_settings', ['name' => 'display_terms_and_conditions', 'value' => '0']);
|
||||
$this->db->insert('ea_settings',
|
||||
['name' => 'terms_and_conditions_content', 'value' => 'Terms and conditions content.']);
|
||||
$this->db->insert('ea_settings', ['name' => 'display_privacy_policy', 'value' => '0']);
|
||||
$this->db->insert('ea_settings', ['name' => 'privacy_policy_content', 'value' => 'Privacy policy content.']);
|
||||
|
||||
$this->db->query('
|
||||
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,
|
||||
`first_name` VARCHAR(256),
|
||||
`last_name` VARCHAR(256),
|
||||
`email` VARCHAR(512),
|
||||
`ip` VARCHAR(256),
|
||||
`type` VARCHAR(256),
|
||||
PRIMARY KEY (`id`)
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
');
|
||||
}
|
||||
|
||||
/**
|
||||
* Downgrade method.
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->db->delete('ea_settings', ['name' => 'display_cookie_notice']);
|
||||
$this->db->delete('ea_settings', ['name' => 'cookie_notice_content']);
|
||||
$this->db->delete('ea_settings', ['name' => 'display_terms_and_conditions']);
|
||||
$this->db->delete('ea_settings', ['name' => 'terms_and_conditions_content']);
|
||||
$this->db->delete('ea_settings', ['name' => 'display_privacy_policy']);
|
||||
$this->db->delete('ea_settings', ['name' => 'privacy_policy_content']);
|
||||
|
||||
$this->db->query('DROP TABLE `ea_consents`;');
|
||||
}
|
||||
}
|
|
@ -14,37 +14,19 @@
|
|||
/**
|
||||
* Class Migration_Add_weekday_start_setting
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Add_weekday_start_setting extends CI_Migration {
|
||||
/**
|
||||
* Migration_Add_weekday_start_setting constructor.
|
||||
*
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct($config = [])
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$this->load->model('settings_model');
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade method.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->settings_model->get_setting('first_weekday');
|
||||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->settings_model->set_setting('first_weekday', 'sunday');
|
||||
}
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'first_weekday',
|
||||
'value' => 'sunday'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,6 +34,6 @@ class Migration_Add_weekday_start_setting extends CI_Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->settings_model->remove_setting('first_weekday');
|
||||
$this->db->delete('ea_settings', ['name' => 'first_weekday']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,14 +12,12 @@
|
|||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Class Migration_add_appointment_location_column
|
||||
* Class Migration_Create_appointment_location_column
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_add_appointment_location_column extends CI_Migration {
|
||||
class Migration_Create_appointment_location_column extends CI_Migration {
|
||||
/**
|
||||
* Upgrade method.
|
||||
*/
|
|
@ -12,14 +12,12 @@
|
|||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Class Migration_Add_user_extra_working_plan
|
||||
* Class Migration_Add_extra_working_plan_to_user_settings
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Add_user_extra_working_plan extends CI_Migration {
|
||||
class Migration_Add_extra_working_plan_to_user_settings extends CI_Migration {
|
||||
/**
|
||||
* Upgrade method.
|
||||
*/
|
||||
|
@ -31,7 +29,6 @@ class Migration_Add_user_extra_working_plan extends CI_Migration {
|
|||
'extra_working_plan' => [
|
||||
'type' => 'TEXT',
|
||||
'null' => TRUE,
|
||||
'default' => '',
|
||||
'after' => 'working_plan'
|
||||
]
|
||||
];
|
|
@ -14,37 +14,19 @@
|
|||
/**
|
||||
* Class Migration_Add_require_phone_number_setting
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Add_require_phone_number_setting extends CI_Migration {
|
||||
/**
|
||||
* Migration_Add_require_phone_number_setting constructor.
|
||||
*
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct($config = [])
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$this->load->model('settings_model');
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade method.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->settings_model->get_setting('require_phone_number');
|
||||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->settings_model->set_setting('require_phone_number', '1');
|
||||
}
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'require_phone_number',
|
||||
'value' => '1'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,6 +34,6 @@ class Migration_Add_require_phone_number_setting extends CI_Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->settings_model->remove_setting('require_phone_number');
|
||||
$this->db->delete('ea_settings', ['name' => 'require_phone_number']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,24 +14,10 @@
|
|||
/**
|
||||
* Class Migration_Add_api_token_setting
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Add_api_token_setting extends CI_Migration {
|
||||
/**
|
||||
* Migration_Add_api_token_setting constructor.
|
||||
*
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct($config = [])
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$this->load->model('settings_model');
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade method.
|
||||
*
|
||||
|
@ -39,14 +25,10 @@ class Migration_Add_api_token_setting extends CI_Migration {
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->settings_model->get_setting('api_token');
|
||||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->settings_model->set_setting('api_token', '');
|
||||
}
|
||||
$this->db->insert('ea_settings', [
|
||||
'name' => 'api_token',
|
||||
'value' => ''
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,6 +38,6 @@ class Migration_Add_api_token_setting extends CI_Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->settings_model->remove_setting('api_token');
|
||||
$this->db->delete('ea_settings', ['name' => 'api_token']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
<?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_timezone_columns
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Add_timezone_columns extends CI_Migration {
|
||||
/**
|
||||
* Upgrade method.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$this->db->query('
|
||||
ALTER TABLE `ea_users`
|
||||
ADD `timezone` VARCHAR(256) DEFAULT "UTC" AFTER `notes`;
|
||||
');
|
||||
}
|
||||
|
||||
/**
|
||||
* Downgrade method.
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->db->query('
|
||||
ALTER TABLE `ea_users`
|
||||
DROP COLUMN `timezone`;
|
||||
');
|
||||
}
|
||||
}
|
|
@ -8,31 +8,33 @@
|
|||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.0.0
|
||||
* @since v1.4.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Class Migration_Specific_calendar_sync
|
||||
* Class Migration_Add_timezone_to_users
|
||||
*
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
*/
|
||||
class Migration_Specific_calendar_sync extends CI_Migration {
|
||||
class Migration_Add_timezone_to_users extends CI_Migration {
|
||||
/**
|
||||
* Upgrade method.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! $this->db->field_exists('google_calendar', 'ea_user_settings'))
|
||||
if ( ! $this->db->field_exists('timezone', 'ea_users'))
|
||||
{
|
||||
$fields = [
|
||||
'google_calendar' => [
|
||||
'timezone' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '128',
|
||||
'null' => TRUE
|
||||
'constraint' => '256',
|
||||
'default' => 'UTC',
|
||||
'after' => 'notes'
|
||||
]
|
||||
];
|
||||
$this->dbforge->add_column('ea_user_settings', $fields);
|
||||
|
||||
$this->dbforge->add_column('ea_users', $fields);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,9 +43,6 @@ class Migration_Specific_calendar_sync extends CI_Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
if ($this->db->field_exists('google_calendar', 'ea_user_settings'))
|
||||
{
|
||||
$this->dbforge->drop_column('ea_user_settings', 'google_calendar');
|
||||
}
|
||||
$this->dbforge->drop_column('ea_users', 'timezone');
|
||||
}
|
||||
}
|
|
@ -14,10 +14,8 @@
|
|||
/**
|
||||
* Class Migration_Add_display_any_provider_setting
|
||||
*
|
||||
* @property CI_Loader load
|
||||
* @property CI_DB_query_builder db
|
||||
* @property CI_DB_forge dbforge
|
||||
* @property Settings_Model settings_model
|
||||
*/
|
||||
class Migration_Add_display_any_provider_setting extends CI_Migration {
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue