From 9d91b99dbc3bf8a19aaac959fa143ffd5b132cd3 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Wed, 20 Jul 2016 20:47:47 +0200 Subject: [PATCH] Added migration file for the availabilities type. --- src/application/config/migration.php | 2 +- .../007_add_service_availabilities_type.php | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/application/migrations/007_add_service_availabilities_type.php diff --git a/src/application/config/migration.php b/src/application/config/migration.php index b28e9049..4c5404de 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'] = 6; // current +$config['migration_version'] = 7; // current /* diff --git a/src/application/migrations/007_add_service_availabilities_type.php b/src/application/migrations/007_add_service_availabilities_type.php new file mode 100644 index 00000000..48c0b2a5 --- /dev/null +++ b/src/application/migrations/007_add_service_availabilities_type.php @@ -0,0 +1,37 @@ + + * @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_service_availabilities_type extends CI_Migration { + public function up() { + $this->load->dbforge(); + + $fields = [ + 'availabilities_type' => [ + 'type' => 'VARCHAR', + 'constraint' => '32', + 'default' => 'flexible', + 'null' => true, + 'after' => 'description' + ] + ]; + + $this->dbforge->add_column('ea_services', $fields); + + $this->db->update('ea_services', ['availabilities_type' => 'flexible']); + } + + public function down() { + $this->load->dbforge(); + $this->dbforge->drop_column('ea_services', 'availabilities_type'); + } +}