Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorMarin Jankovski <maxlazio@gmail.com>2014-10-06 18:50:24 +0400
committerMarin Jankovski <maxlazio@gmail.com>2014-10-06 18:50:24 +0400
commiteceef546d19c16d16772868a05e6769907442f83 (patch)
treea14564734f6000073b96a12fbcd7de78b630c30d /db
parent1db8d3104cfab111771a7afbaa015e989640fde4 (diff)
Add slack service migration.
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"