diff --git a/database/migrations/2020_09_18_230114_create_services_template_table.php b/database/migrations/2020_09_18_230114_create_services_template_table.php index 105d4c79da..7d8bb89acb 100644 --- a/database/migrations/2020_09_18_230114_create_services_template_table.php +++ b/database/migrations/2020_09_18_230114_create_services_template_table.php @@ -20,7 +20,11 @@ class CreateServicesTemplateTable extends Migration $table->text('desc'); $table->text('param'); $table->boolean('ignore')->default(0); - $table->unsignedInteger('changed')->default(0); + if (\LibreNMS\DB\Eloquent::getDriver() == 'mysql') { + $table->timestamp('changed')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP')); + } else { + $table->timestamp('changed')->useCurrent(); + } $table->boolean('disabled')->default(0); $table->string('name'); }); diff --git a/misc/db_schema.yaml b/misc/db_schema.yaml index c327d2fcba..8ad4980c1b 100644 --- a/misc/db_schema.yaml +++ b/misc/db_schema.yaml @@ -1735,7 +1735,7 @@ service_templates: - { Field: desc, Type: text, 'Null': false, Extra: '' } - { Field: param, Type: text, 'Null': false, Extra: '' } - { Field: ignore, Type: tinyint, 'Null': false, Extra: '', Default: '0' } - - { Field: changed, Type: 'int unsigned', 'Null': false, Extra: '', Default: '0' } + - { Field: changed, Type: 'int unsigned', 'Null': false, , Extra: 'on update CURRENT_TIMESTAMP', Default: CURRENT_TIMESTAMP } - { Field: disabled, Type: tinyint, 'Null': false, Extra: '', Default: '0' } - { Field: name, Type: varchar(255), 'Null': false, Extra: '' } Indexes: diff --git a/resources/views/service-template/index.blade.php b/resources/views/service-template/index.blade.php index a5ab53c191..2b96780a65 100644 --- a/resources/views/service-template/index.blade.php +++ b/resources/views/service-template/index.blade.php @@ -36,33 +36,35 @@
@foreach($service_templates as $service_template) -