Add slack service migration.
This commit is contained in:
parent
1db8d3104c
commit
eceef546d1
2 changed files with 18 additions and 1 deletions
17
db/migrate/20141006143943_move_slack_service_to_webhook.rb
Normal file
17
db/migrate/20141006143943_move_slack_service_to_webhook.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
class MoveSlackServiceToWebhook < ActiveRecord::Migration
|
||||
def change
|
||||
SlackService.all.each do |slack_service|
|
||||
if ["token", "subdomain"].all? { |property| slack_service.properties.key? property }
|
||||
token = slack_service.properties['token']
|
||||
subdomain = slack_service.properties['subdomain']
|
||||
webhook = "https://#{subdomain}.slack.com/services/hooks/incoming-webhook?token=#{token}"
|
||||
slack_service.properties['webhook'] = webhook
|
||||
slack_service.properties.delete('token')
|
||||
slack_service.properties.delete('subdomain')
|
||||
# Room is configured on the Slack side
|
||||
slack_service.properties.delete('room')
|
||||
slack_service.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20140914173417) do
|
||||
ActiveRecord::Schema.define(version: 20141006143943) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
|
Loading…
Reference in a new issue