mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-24 08:53:05 +03:00
Perform setting related migration improvements
This commit is contained in:
parent
14305d08cc
commit
66106fcd18
4 changed files with 44 additions and 20 deletions
|
@ -19,10 +19,13 @@ class Migration_Add_google_analytics_setting extends EA_Migration {
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
$this->db->insert('settings', [
|
||||
'name' => 'google_analytics_code',
|
||||
'value' => ''
|
||||
]);
|
||||
if ( ! $this->db->get_where('settings', ['name' => 'google_analytics_code'])->num_rows())
|
||||
{
|
||||
$this->db->insert('settings', [
|
||||
'name' => 'google_analytics_code',
|
||||
'value' => ''
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,6 +35,9 @@ class Migration_Add_google_analytics_setting extends EA_Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->db->delete('settings', ['name' => 'google_analytics_code']);
|
||||
if ($this->db->get_where('settings', ['name' => 'google_analytics_code'])->num_rows())
|
||||
{
|
||||
$this->db->delete('settings', ['name' => 'google_analytics_code']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,10 +19,13 @@ class Migration_Add_customer_notifications_setting extends EA_Migration {
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
$this->db->insert('settings', [
|
||||
'name' => 'customer_notifications',
|
||||
'value' => '1'
|
||||
]);
|
||||
if ( ! $this->db->get_where('settings', ['name' => 'customer_notifications'])->num_rows())
|
||||
{
|
||||
$this->db->insert('settings', [
|
||||
'name' => 'customer_notifications',
|
||||
'value' => '1'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,6 +35,9 @@ class Migration_Add_customer_notifications_setting extends EA_Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->db->delete('settings', ['name' => 'customer_notifications']);
|
||||
if ($this->db->get_where('settings', ['name' => 'customer_notifications'])->num_rows())
|
||||
{
|
||||
$this->db->delete('settings', ['name' => 'customer_notifications']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,10 +19,13 @@ class Migration_Add_date_format_setting extends EA_Migration {
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
$this->db->insert('settings', [
|
||||
'name' => 'date_format',
|
||||
'value' => 'DMY'
|
||||
]);
|
||||
if ( ! $this->db->get_where('settings', ['name' => 'date_format'])->num_rows())
|
||||
{
|
||||
$this->db->insert('settings', [
|
||||
'name' => 'date_format',
|
||||
'value' => 'DMY'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,6 +35,9 @@ class Migration_Add_date_format_setting extends EA_Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->db->delete('settings', ['name' => 'date_format']);
|
||||
if ($this->db->get_where('settings', ['name' => 'date_format'])->num_rows())
|
||||
{
|
||||
$this->db->delete('settings', ['name' => 'date_format']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,10 +19,13 @@ class Migration_Add_require_captcha_setting extends EA_Migration {
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
$this->db->insert('settings', [
|
||||
'name' => 'require_captcha',
|
||||
'value' => '0'
|
||||
]);
|
||||
if ( ! $this->db->get_where('settings', ['name' => 'require_captcha'])->num_rows())
|
||||
{
|
||||
$this->db->insert('settings', [
|
||||
'name' => 'require_captcha',
|
||||
'value' => '0'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,6 +35,9 @@ class Migration_Add_require_captcha_setting extends EA_Migration {
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->db->delete('settings', ['name' => 'require_captcha']);
|
||||
if ($this->db->get_where('settings', ['name' => 'require_captcha'])->num_rows())
|
||||
{
|
||||
$this->db->delete('settings', ['name' => 'require_captcha']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue