diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-10-07 00:27:15 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-10-07 00:27:15 +0900 |
commit | 830c770a532fc94e1b1a70064500c9bd63712de4 (patch) | |
tree | 140141b7c9ac92cdce29e71b6da6f00bcde9f51a /db | |
parent | 3e26b0dcd113ade77dc8304137c6733cab4c8718 (diff) | |
parent | 7f8e720f415ff50f791d9efd49b774c9da9ab109 (diff) | |
download | gitlab-ce-830c770a532fc94e1b1a70064500c9bd63712de4.tar.gz |
Merge branch 'master' into feature/sm/35954-create-kubernetes-cluster-on-gke-from-k8s-service
Diffstat (limited to 'db')
4 files changed, 76 insertions, 1 deletions
diff --git a/db/migrate/20170927161718_create_gpg_key_subkeys.rb b/db/migrate/20170927161718_create_gpg_key_subkeys.rb new file mode 100644 index 00000000000..c03c40416a8 --- /dev/null +++ b/db/migrate/20170927161718_create_gpg_key_subkeys.rb @@ -0,0 +1,23 @@ +class CreateGpgKeySubkeys < ActiveRecord::Migration + DOWNTIME = false + + def up + create_table :gpg_key_subkeys do |t| + t.references :gpg_key, null: false, index: true, foreign_key: { on_delete: :cascade } + + t.binary :keyid + t.binary :fingerprint + + t.index :keyid, unique: true, length: Gitlab::Database.mysql? ? 20 : nil + t.index :fingerprint, unique: true, length: Gitlab::Database.mysql? ? 20 : nil + end + + add_reference :gpg_signatures, :gpg_key_subkey, index: true, foreign_key: { on_delete: :nullify } + end + + def down + remove_reference(:gpg_signatures, :gpg_key_subkey, index: true, foreign_key: true) + + drop_table :gpg_key_subkeys + end +end diff --git a/db/migrate/20170929080234_add_failure_reason_to_pipelines.rb b/db/migrate/20170929080234_add_failure_reason_to_pipelines.rb new file mode 100644 index 00000000000..82adddbc1ec --- /dev/null +++ b/db/migrate/20170929080234_add_failure_reason_to_pipelines.rb @@ -0,0 +1,9 @@ +class AddFailureReasonToPipelines < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :ci_pipelines, :failure_reason, :integer + end +end diff --git a/db/post_migrate/20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb b/db/post_migrate/20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb new file mode 100644 index 00000000000..01d56fbd490 --- /dev/null +++ b/db/post_migrate/20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb @@ -0,0 +1,28 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class ScheduleCreateGpgKeySubkeysFromGpgKeys < ActiveRecord::Migration + disable_ddl_transaction! + + DOWNTIME = false + MIGRATION = 'CreateGpgKeySubkeysFromGpgKeys' + + class GpgKey < ActiveRecord::Base + self.table_name = 'gpg_keys' + + include EachBatch + end + + def up + GpgKey.select(:id).each_batch do |gpg_keys| + jobs = gpg_keys.pluck(:id).map do |id| + [MIGRATION, [id]] + end + + BackgroundMigrationWorker.perform_bulk(jobs) + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 5f8f4bb7d5e..c9420a39088 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: 20171004121444) do +ActiveRecord::Schema.define(version: 20171005130944) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -342,6 +342,7 @@ ActiveRecord::Schema.define(version: 20171004121444) do t.integer "source" t.integer "config_source" t.boolean "protected" + t.integer "failure_reason" end add_index "ci_pipelines", ["auto_canceled_by_id"], name: "index_ci_pipelines_on_auto_canceled_by_id", using: :btree @@ -608,6 +609,16 @@ ActiveRecord::Schema.define(version: 20171004121444) do add_index "gcp_clusters", ["project_id"], name: "index_gcp_clusters_on_project_id", unique: true, using: :btree + create_table "gpg_key_subkeys", force: :cascade do |t| + t.integer "gpg_key_id", null: false + t.binary "keyid" + t.binary "fingerprint" + end + + add_index "gpg_key_subkeys", ["fingerprint"], name: "index_gpg_key_subkeys_on_fingerprint", unique: true, using: :btree + add_index "gpg_key_subkeys", ["gpg_key_id"], name: "index_gpg_key_subkeys_on_gpg_key_id", using: :btree + add_index "gpg_key_subkeys", ["keyid"], name: "index_gpg_key_subkeys_on_keyid", unique: true, using: :btree + create_table "gpg_keys", force: :cascade do |t| t.datetime_with_timezone "created_at", null: false t.datetime_with_timezone "updated_at", null: false @@ -631,11 +642,13 @@ ActiveRecord::Schema.define(version: 20171004121444) do t.text "gpg_key_user_name" t.text "gpg_key_user_email" t.integer "verification_status", limit: 2, default: 0, null: false + t.integer "gpg_key_subkey_id" end add_index "gpg_signatures", ["commit_sha"], name: "index_gpg_signatures_on_commit_sha", unique: true, using: :btree add_index "gpg_signatures", ["gpg_key_id"], name: "index_gpg_signatures_on_gpg_key_id", using: :btree add_index "gpg_signatures", ["gpg_key_primary_keyid"], name: "index_gpg_signatures_on_gpg_key_primary_keyid", using: :btree + add_index "gpg_signatures", ["gpg_key_subkey_id"], name: "index_gpg_signatures_on_gpg_key_subkey_id", using: :btree add_index "gpg_signatures", ["project_id"], name: "index_gpg_signatures_on_project_id", using: :btree create_table "identities", force: :cascade do |t| @@ -1758,7 +1771,9 @@ ActiveRecord::Schema.define(version: 20171004121444) do add_foreign_key "gcp_clusters", "projects", on_delete: :cascade add_foreign_key "gcp_clusters", "services", on_delete: :nullify add_foreign_key "gcp_clusters", "users", on_delete: :nullify + add_foreign_key "gpg_key_subkeys", "gpg_keys", on_delete: :cascade add_foreign_key "gpg_keys", "users", on_delete: :cascade + add_foreign_key "gpg_signatures", "gpg_key_subkeys", on_delete: :nullify add_foreign_key "gpg_signatures", "gpg_keys", on_delete: :nullify add_foreign_key "gpg_signatures", "projects", on_delete: :cascade add_foreign_key "issue_assignees", "issues", name: "fk_b7d881734a", on_delete: :cascade |