From 1c6ba6308b8e26bc130fc7693a7190196df561f3 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Sun, 17 Jul 2016 12:37:00 +0200 Subject: [PATCH] Created migration class for new setting (#182). --- src/application/config/migration.php | 2 +- .../006_add_calendar_view_setting.php | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/application/migrations/006_add_calendar_view_setting.php diff --git a/src/application/config/migration.php b/src/application/config/migration.php index 56eeb960..b28e9049 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'] = 5; // current +$config['migration_version'] = 6; // current /* diff --git a/src/application/migrations/006_add_calendar_view_setting.php b/src/application/migrations/006_add_calendar_view_setting.php new file mode 100644 index 00000000..57dfdb28 --- /dev/null +++ b/src/application/migrations/006_add_calendar_view_setting.php @@ -0,0 +1,36 @@ + + * @copyright Copyright (c) 2013 - 2016, Alex Tselegidis + * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link http://easyappointments.org + * @since v1.2.0 + * ---------------------------------------------------------------------------- */ + +class Migration_Add_calendar_view_setting extends CI_Migration { + public function up() { + $this->load->dbforge(); + + $fields = [ + 'calendar_view' => [ + 'type' => 'VARCHAR', + 'constraint' => '32', + 'default' => 'default', + 'null' => true + ] + ]; + + $this->dbforge->add_column('ea_user_settings', $fields); + + $this->db->update('ea_user_settings', ['ea_user_settings' => 'default']); + } + + public function down() { + $this->load->dbforge(); + $this->dbforge->drop_column('ea_user_settings', 'calendar_view'); + } +}