diff options
author | Jarka Košanová <jarka@gitlab.com> | 2019-05-22 18:47:42 +0300 |
---|---|---|
committer | Jarka Košanová <jarka@gitlab.com> | 2019-06-13 20:02:13 +0300 |
commit | 1f332ae8da994509232c7601074b25514ad23c52 (patch) | |
tree | 91d0facea9e413baa568caf6af406a0fdef823b8 /db | |
parent | 07f8f2056d7143c770d420ec3345781802047810 (diff) |
Create models for issue trackers data
- create tables for storing issue trackers properties
- add model and basic logic & spec
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20190430131225_create_issue_tracker_data.rb | 23 | ||||
-rw-r--r-- | db/migrate/20190430142025_create_jira_tracker_data.rb | 26 | ||||
-rw-r--r-- | db/schema.rb | 31 |
3 files changed, 80 insertions, 0 deletions
diff --git a/db/migrate/20190430131225_create_issue_tracker_data.rb b/db/migrate/20190430131225_create_issue_tracker_data.rb new file mode 100644 index 00000000000..7859bea9c22 --- /dev/null +++ b/db/migrate/20190430131225_create_issue_tracker_data.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class CreateIssueTrackerData < ActiveRecord::Migration[5.1] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :issue_tracker_data do |t| + t.references :service, foreign_key: { on_delete: :cascade }, type: :integer, index: true, null: false + t.timestamps_with_timezone + t.string :encrypted_project_url + t.string :encrypted_project_url_iv + t.string :encrypted_issues_url + t.string :encrypted_issues_url_iv + t.string :encrypted_new_issue_url + t.string :encrypted_new_issue_url_iv + end + end +end diff --git a/db/migrate/20190430142025_create_jira_tracker_data.rb b/db/migrate/20190430142025_create_jira_tracker_data.rb new file mode 100644 index 00000000000..d328ad63854 --- /dev/null +++ b/db/migrate/20190430142025_create_jira_tracker_data.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class CreateJiraTrackerData < ActiveRecord::Migration[5.1] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :jira_tracker_data do |t| + t.references :service, foreign_key: { on_delete: :cascade }, type: :integer, index: true, null: false + t.timestamps_with_timezone + t.string :encrypted_url + t.string :encrypted_url_iv + t.string :encrypted_api_url + t.string :encrypted_api_url_iv + t.string :encrypted_username + t.string :encrypted_username_iv + t.string :encrypted_password + t.string :encrypted_password_iv + t.string :jira_issue_transition_id + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 22d0cddb7a0..6b9e8646945 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1066,6 +1066,19 @@ ActiveRecord::Schema.define(version: 20190530154715) do t.index ["issue_id"], name: "index_issue_metrics", using: :btree end + create_table "issue_tracker_data", force: :cascade do |t| + t.integer "service_id", null: false + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false + t.string "encrypted_project_url" + t.string "encrypted_project_url_iv" + t.string "encrypted_issues_url" + t.string "encrypted_issues_url_iv" + t.string "encrypted_new_issue_url" + t.string "encrypted_new_issue_url_iv" + t.index ["service_id"], name: "index_issue_tracker_data_on_service_id", using: :btree + end + create_table "issues", id: :serial, force: :cascade do |t| t.string "title" t.integer "author_id" @@ -1109,6 +1122,22 @@ ActiveRecord::Schema.define(version: 20190530154715) do t.index ["updated_by_id"], name: "index_issues_on_updated_by_id", where: "(updated_by_id IS NOT NULL)", using: :btree end + create_table "jira_tracker_data", force: :cascade do |t| + t.integer "service_id", null: false + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false + t.string "encrypted_url" + t.string "encrypted_url_iv" + t.string "encrypted_api_url" + t.string "encrypted_api_url_iv" + t.string "encrypted_username" + t.string "encrypted_username_iv" + t.string "encrypted_password" + t.string "encrypted_password_iv" + t.string "jira_issue_transition_id" + t.index ["service_id"], name: "index_jira_tracker_data_on_service_id", using: :btree + end + create_table "keys", id: :serial, force: :cascade do |t| t.integer "user_id" t.datetime "created_at" @@ -2530,12 +2559,14 @@ ActiveRecord::Schema.define(version: 20190530154715) do add_foreign_key "issue_assignees", "issues", name: "fk_b7d881734a", on_delete: :cascade add_foreign_key "issue_assignees", "users", name: "fk_5e0c8d9154", on_delete: :cascade add_foreign_key "issue_metrics", "issues", on_delete: :cascade + add_foreign_key "issue_tracker_data", "services", on_delete: :cascade add_foreign_key "issues", "issues", column: "moved_to_id", name: "fk_a194299be1", on_delete: :nullify add_foreign_key "issues", "milestones", name: "fk_96b1dd429c", on_delete: :nullify add_foreign_key "issues", "projects", name: "fk_899c8f3231", on_delete: :cascade add_foreign_key "issues", "users", column: "author_id", name: "fk_05f1e72feb", on_delete: :nullify add_foreign_key "issues", "users", column: "closed_by_id", name: "fk_c63cbf6c25", on_delete: :nullify add_foreign_key "issues", "users", column: "updated_by_id", name: "fk_ffed080f01", on_delete: :nullify + add_foreign_key "jira_tracker_data", "services", on_delete: :cascade add_foreign_key "label_links", "labels", name: "fk_d97dd08678", on_delete: :cascade add_foreign_key "label_priorities", "labels", on_delete: :cascade add_foreign_key "label_priorities", "projects", on_delete: :cascade |