summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20141006143943_move_slack_service_to_webhook.rb17
-rw-r--r--db/schema.rb2
2 files changed, 18 insertions, 1 deletions
diff --git a/db/migrate/20141006143943_move_slack_service_to_webhook.rb b/db/migrate/20141006143943_move_slack_service_to_webhook.rb
new file mode 100644
index 00000000000..4b62b223cbf
--- /dev/null
+++ b/db/migrate/20141006143943_move_slack_service_to_webhook.rb
@@ -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
diff --git a/db/schema.rb b/db/schema.rb
index 4e249caa022..84fd1256677 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -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"