trabajo-afectivo/db/migrate/20161122000001_monitoring_issue_453.rb

38 lines
907 B
Ruby
Raw Normal View History

2017-09-08 08:28:34 +00:00
class MonitoringIssue453 < ActiveRecord::Migration[4.2]
def up
# return if it's a new setup
return if !Setting.exists?(name: 'system_init_done')
Setting.create_if_not_exists(
title: 'Monitoring Token',
name: 'monitoring_token',
area: 'HealthCheck::Base',
description: 'Token for Monitoring.',
options: {
form: [
{
display: '',
null: false,
name: 'monitoring_token',
tag: 'input',
},
],
},
state: SecureRandom.urlsafe_base64(40),
preferences: {
permission: ['admin.monitoring'],
},
frontend: false,
)
Permission.create_if_not_exists(
name: 'admin.monitoring',
note: 'Manage %s',
preferences: {
translations: ['Monitoring']
},
)
end
end