diff --git a/application/migrations/026_add_color_column_to_services_table.php b/application/migrations/026_add_color_column_to_services_table.php new file mode 100644 index 00000000..62a9a77c --- /dev/null +++ b/application/migrations/026_add_color_column_to_services_table.php @@ -0,0 +1,49 @@ + + * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis + * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link http://easyappointments.org + * @since v1.4.0 + * ---------------------------------------------------------------------------- */ + +/** + * @property CI_DB_query_builder db + * @property CI_DB_forge $dbforge + */ +class Migration_Add_color_column_to_services_table extends CI_Migration { + /** + * Upgrade method. + */ + public function up() + { + if ( ! $this->db->field_exists('color', 'services')) + { + $fields = [ + 'color' => [ + 'type' => 'VARCHAR', + 'constraint' => '256', + 'default' => '#4c95d2', + 'after' => 'description' + ] + ]; + + $this->dbforge->add_column('services', $fields); + } + } + + /** + * Downgrade method. + */ + public function down() + { + if ( ! $this->db->field_exists('color', 'services')) + { + $this->dbforge->drop_column('services', 'color'); + } + } +} diff --git a/application/migrations/027_add_color_column_to_appointments_table.php b/application/migrations/027_add_color_column_to_appointments_table.php new file mode 100644 index 00000000..faccd88b --- /dev/null +++ b/application/migrations/027_add_color_column_to_appointments_table.php @@ -0,0 +1,49 @@ + + * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis + * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link http://easyappointments.org + * @since v1.4.0 + * ---------------------------------------------------------------------------- */ + +/** + * @property CI_DB_query_builder db + * @property CI_DB_forge $dbforge + */ +class Migration_Add_color_column_to_appointments_table extends CI_Migration { + /** + * Upgrade method. + */ + public function up() + { + if ( ! $this->db->field_exists('color', 'appointments')) + { + $fields = [ + 'color' => [ + 'type' => 'VARCHAR', + 'constraint' => '256', + 'default' => '#4c95d2', + 'after' => 'hash' + ] + ]; + + $this->dbforge->add_column('appointments', $fields); + } + } + + /** + * Downgrade method. + */ + public function down() + { + if ( ! $this->db->field_exists('color', 'appointments')) + { + $this->dbforge->drop_column('appointments', 'color'); + } + } +}