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:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-10 21:47:47 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-10 21:47:47 +0400
commit6135eb0adf6e3f2a13b7ef1d998b02a0f3349cc4 (patch)
tree63e30bb9b5f8191ef341fd05eb255dbf9cdb4aa1 /db
parent4a5719f99075a1bdcce727899e9186ac78d096f0 (diff)
parenta0dbcd2365b9c90892ccd0c5dfb18c7c58de8704 (diff)
Merge pull request #7705 from dblessing/serialize_service_properties
Serialize service properties
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20140907220153_serialize_service_properties.rb35
-rw-r--r--db/schema.rb13
2 files changed, 39 insertions, 9 deletions
diff --git a/db/migrate/20140907220153_serialize_service_properties.rb b/db/migrate/20140907220153_serialize_service_properties.rb
new file mode 100644
index 00000000000..2326fd0aebf
--- /dev/null
+++ b/db/migrate/20140907220153_serialize_service_properties.rb
@@ -0,0 +1,35 @@
+class SerializeServiceProperties < ActiveRecord::Migration
+ def change
+ add_column :services, :properties, :text
+
+ associations =
+ {
+ AssemblaService: [:token, :subdomain],
+ CampfireService: [:token, :subdomain, :room],
+ EmailsOnPushService: [:recipients],
+ FlowdockService: [:token],
+ GemnasiumService: [:api_key, :token],
+ GitlabCiService: [:token, :project_url],
+ HipchatService: [:token, :room],
+ PivotaltrackerService: [:token],
+ SlackService: [:subdomain, :token, :room],
+ JenkinsService: [:token, :subdomain],
+ JiraService: [:project_url, :username, :password,
+ :api_version, :jira_issue_transition_id],
+ }
+
+ Service.all.each do |service|
+ associations[service.type.to_sym].each do |attribute|
+ service.send("#{attribute}=", service.attributes[attribute.to_s])
+ end
+ service.save!
+ end
+
+ remove_column :services, :project_url, :string
+ remove_column :services, :subdomain, :string
+ remove_column :services, :room, :string
+ remove_column :services, :recipients, :text
+ remove_column :services, :api_key, :string
+ remove_column :services, :token, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index a2dda07c102..e9b3713557d 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: 20140903115954) do
+ActiveRecord::Schema.define(version: 20140907220153) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -265,16 +265,11 @@ ActiveRecord::Schema.define(version: 20140903115954) do
create_table "services", force: true do |t|
t.string "type"
t.string "title"
- t.string "token"
- t.integer "project_id", null: false
+ t.integer "project_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
- t.boolean "active", default: false, null: false
- t.string "project_url"
- t.string "subdomain"
- t.string "room"
- t.text "recipients"
- t.string "api_key"
+ t.boolean "active", default: false, null: false
+ t.text "properties"
end
add_index "services", ["project_id"], name: "index_services_on_project_id", using: :btree