Do not update alert timestamp when updating a triggered alert (#10907)

* Do not update alert timestamp when updating a triggered alert

* Only update alerts timestamp if alert is triggered or recovered

* db schema

* db schema

* cleanup timestamp update
This commit is contained in:
louis-oui
2020-01-22 22:01:25 +01:00
committed by Kevin Krumm
parent 1c043069b1
commit a384fc2830
3 changed files with 31 additions and 3 deletions

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AlertsDisableOnUpdateCurrentTimestamp extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
\DB::statement("ALTER TABLE `alerts` CHANGE `timestamp` `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP;");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
\DB::statement("ALTER TABLE `alerts` CHANGE `timestamp` `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP;");
}
}