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
|
@ -18,12 +18,15 @@ class Migration_Add_google_analytics_setting extends EA_Migration {
|
|||
* @throws Exception
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! $this->db->get_where('settings', ['name' => 'google_analytics_code'])->num_rows())
|
||||
{
|
||||
$this->db->insert('settings', [
|
||||
'name' => 'google_analytics_code',
|
||||
'value' => ''
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Downgrade method.
|
||||
|
@ -31,7 +34,10 @@ class Migration_Add_google_analytics_setting extends EA_Migration {
|
|||
* @throws Exception
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
if ($this->db->get_where('settings', ['name' => 'google_analytics_code'])->num_rows())
|
||||
{
|
||||
$this->db->delete('settings', ['name' => 'google_analytics_code']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,12 +18,15 @@ class Migration_Add_customer_notifications_setting extends EA_Migration {
|
|||
* @throws Exception
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! $this->db->get_where('settings', ['name' => 'customer_notifications'])->num_rows())
|
||||
{
|
||||
$this->db->insert('settings', [
|
||||
'name' => 'customer_notifications',
|
||||
'value' => '1'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Downgrade method.
|
||||
|
@ -31,7 +34,10 @@ class Migration_Add_customer_notifications_setting extends EA_Migration {
|
|||
* @throws Exception
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
if ($this->db->get_where('settings', ['name' => 'customer_notifications'])->num_rows())
|
||||
{
|
||||
$this->db->delete('settings', ['name' => 'customer_notifications']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,12 +18,15 @@ class Migration_Add_date_format_setting extends EA_Migration {
|
|||
* @throws Exception
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! $this->db->get_where('settings', ['name' => 'date_format'])->num_rows())
|
||||
{
|
||||
$this->db->insert('settings', [
|
||||
'name' => 'date_format',
|
||||
'value' => 'DMY'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Downgrade method.
|
||||
|
@ -31,7 +34,10 @@ class Migration_Add_date_format_setting extends EA_Migration {
|
|||
* @throws Exception
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
if ($this->db->get_where('settings', ['name' => 'date_format'])->num_rows())
|
||||
{
|
||||
$this->db->delete('settings', ['name' => 'date_format']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,12 +18,15 @@ class Migration_Add_require_captcha_setting extends EA_Migration {
|
|||
* @throws Exception
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! $this->db->get_where('settings', ['name' => 'require_captcha'])->num_rows())
|
||||
{
|
||||
$this->db->insert('settings', [
|
||||
'name' => 'require_captcha',
|
||||
'value' => '0'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Downgrade method.
|
||||
|
@ -31,7 +34,10 @@ class Migration_Add_require_captcha_setting extends EA_Migration {
|
|||
* @throws Exception
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
if ($this->db->get_where('settings', ['name' => 'require_captcha'])->num_rows())
|
||||
{
|
||||
$this->db->delete('settings', ['name' => 'require_captcha']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue