-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add color columns on service and appointment tables (#422).
- Loading branch information
1 parent
b65eabd
commit df1d4fd
Showing
2 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
application/migrations/026_add_color_column_to_services_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
} | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
application/migrations/027_add_color_column_to_appointments_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
} | ||
} | ||
} |