Added migration that add the "google_analytics_code" setting in the database.
This commit is contained in:
parent
722daac2cd
commit
e0c3c0eba5
3 changed files with 81 additions and 53 deletions
|
@ -1,41 +1,41 @@
|
||||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Enable/Disable Migrations
|
| Enable/Disable Migrations
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Migrations are disabled by default but should be enabled
|
| Migrations are disabled by default but should be enabled
|
||||||
| whenever you intend to do a schema migration.
|
| whenever you intend to do a schema migration.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['migration_enabled'] = TRUE;
|
$config['migration_enabled'] = TRUE;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Migrations version
|
| Migrations version
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This is used to set migration version that the file system should be on.
|
| This is used to set migration version that the file system should be on.
|
||||||
| If you run $this->migration->latest() this is the version that schema will
|
| If you run $this->migration->latest() this is the version that schema will
|
||||||
| be upgraded / downgraded to.
|
| be upgraded / downgraded to.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['migration_version'] = 1; // current
|
$config['migration_version'] = 2; // current
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Migrations Path
|
| Migrations Path
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Path to your migrations folder.
|
| Path to your migrations folder.
|
||||||
| Typically, it will be within your application path.
|
| Typically, it will be within your application path.
|
||||||
| Also, writing permission is required within the migrations path.
|
| Also, writing permission is required within the migrations path.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['migration_path'] = APPPATH . 'migrations/';
|
$config['migration_path'] = APPPATH . 'migrations/';
|
||||||
|
|
||||||
|
|
||||||
/* End of file migration.php */
|
/* End of file migration.php */
|
||||||
/* Location: ./application/config/migration.php */
|
/* Location: ./application/config/migration.php */
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
* Easy!Appointments - Open Source Web Scheduler
|
* Easy!Appointments - Open Source Web Scheduler
|
||||||
*
|
*
|
||||||
* @package EasyAppointments
|
* @package EasyAppointments
|
||||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||||
* @copyright Copyright (c) 2013 - 2015, Alex Tselegidis
|
* @copyright Copyright (c) 2013 - 2015, Alex Tselegidis
|
||||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||||
* @link http://easyappointments.org
|
* @link http://easyappointments.org
|
||||||
* @since v1.0.0
|
* @since v1.0.0
|
||||||
* ---------------------------------------------------------------------------- */
|
* ---------------------------------------------------------------------------- */
|
||||||
|
@ -14,17 +14,21 @@
|
||||||
class Migration_Specific_calendar_sync extends CI_Migration {
|
class Migration_Specific_calendar_sync extends CI_Migration {
|
||||||
|
|
||||||
public function up() {
|
public function up() {
|
||||||
$fields = array(
|
if (!$this->db->field_exists('google_calendar', 'ea_user_settings')) {
|
||||||
'google_calendar' => array(
|
$fields = array(
|
||||||
'type' => 'VARCHAR',
|
'google_calendar' => array(
|
||||||
'constraint' => '128',
|
'type' => 'VARCHAR',
|
||||||
'null' => TRUE)
|
'constraint' => '128',
|
||||||
);
|
'null' => TRUE
|
||||||
|
)
|
||||||
$this->dbforge->add_column('ea_user_settings', $fields);
|
);
|
||||||
|
$this->dbforge->add_column('ea_user_settings', $fields);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down() {
|
public function down() {
|
||||||
$this->dbforge->drop_column('ea_user_settings', 'google_calendar');
|
if ($this->db->field_exists('google_calendar', 'ea_user_settings')) {
|
||||||
|
$this->dbforge->drop_column('ea_user_settings', 'google_calendar');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?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 - 2015, Alex Tselegidis
|
||||||
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||||
|
* @link http://easyappointments.org
|
||||||
|
* @since v1.0.0
|
||||||
|
* ---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
class Migration_Add_google_analytics_setting extends CI_Migration {
|
||||||
|
public function up() {
|
||||||
|
$this->load->model('settings_model');
|
||||||
|
$this->settings_model->set_setting('google_analytics_code', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down() {
|
||||||
|
$this->load->model('settings_model');
|
||||||
|
$this->settings_model->remove_setting('google_analytics_code');
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue