From d88362dcc086880b1afab014b5173221b33387dd Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Tue, 1 Dec 2015 23:08:04 +0100 Subject: [PATCH] Added 'date_format' setting migration. --- rsc/db/sample-data.sql | 1 + src/application/config/constants.php | 4 ++++ src/application/config/migration.php | 2 +- .../004_add_date_format_setting.php | 24 +++++++++++++++++++ src/assets/sql/data.sql | 3 ++- 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 src/application/migrations/004_add_date_format_setting.php diff --git a/rsc/db/sample-data.sql b/rsc/db/sample-data.sql index b27a88b6..c54b0f7c 100644 --- a/rsc/db/sample-data.sql +++ b/rsc/db/sample-data.sql @@ -24,6 +24,7 @@ INSERT INTO `ea_settings` (`id`, `name`, `value`) VALUES (5, 'company_link', 'http://www.abc-company.ea'), (6, 'google_analytics_code', ''); (7, 'customer_notifications', '1'); +(8, 'date_format', 'DMY'); -- -- Dumping data for table `ea_roles` diff --git a/src/application/config/constants.php b/src/application/config/constants.php index 22e445be..5a0bf60e 100644 --- a/src/application/config/constants.php +++ b/src/application/config/constants.php @@ -71,6 +71,10 @@ define('PRIV_USERS', 'users'); define('PRIV_SYSTEM_SETTINGS', 'system_settings'); define('PRIV_USER_SETTINGS', 'user_settings'); +define('DATE_FORMAT_DMY', 'DMY'); +define('DATE_FORMAT_MDY', 'MDY'); +define('DATE_FORMAT_YMD', 'YMD'); + define('MIN_PASSWORD_LENGTH', 7); define('ANY_PROVIDER', 'any-provider'); /* End of file constants.php */ diff --git a/src/application/config/migration.php b/src/application/config/migration.php index 3755216a..b1211cff 100644 --- a/src/application/config/migration.php +++ b/src/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 3; // current +$config['migration_version'] = 4; // current /* diff --git a/src/application/migrations/004_add_date_format_setting.php b/src/application/migrations/004_add_date_format_setting.php new file mode 100644 index 00000000..c014f80f --- /dev/null +++ b/src/application/migrations/004_add_date_format_setting.php @@ -0,0 +1,24 @@ + + * @copyright Copyright (c) 2013 - 2015, Alex Tselegidis + * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link http://easyappointments.org + * @since v1.0.0 + * ---------------------------------------------------------------------------- */ + +class Migration_Add_date_format_setting extends CI_Migration { + public function up() { + $this->load->model('settings_model'); + $this->settings_model->set_setting('date_format', DATE_FORMAT_DMY); + } + + public function down() { + $this->load->model('settings_model'); + $this->settings_model->remove_setting('date_format'); + } +} diff --git a/src/assets/sql/data.sql b/src/assets/sql/data.sql index a74ab8ff..698c323d 100644 --- a/src/assets/sql/data.sql +++ b/src/assets/sql/data.sql @@ -1,3 +1,4 @@ INSERT INTO ea_settings (name, value) VALUES ('google_analytics_code', ''), - ('customer_notifications', '1'); + ('customer_notifications', '1'), + ('date_format', 'DMY');