Skip to content

Commit

Permalink
Add color columns on service and appointment tables (#422).
Browse files Browse the repository at this point in the history
  • Loading branch information
alextselegidis committed Jan 18, 2022
1 parent b65eabd commit df1d4fd
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
49 changes: 49 additions & 0 deletions application/migrations/026_add_color_column_to_services_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?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
* ---------------------------------------------------------------------------- */

/**
* @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');
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?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
* ---------------------------------------------------------------------------- */

/**
* @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');
}
}
}

0 comments on commit df1d4fd

Please sign in to comment.