summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-11-07 14:29:16 +0900
committerShinya Maeda <shinya@gitlab.com>2018-11-07 14:29:16 +0900
commit9c811566f85d18bc9eb4a85c6a343cf1bfa4fbd2 (patch)
tree0d5de6f22917fa5def4e8a9a918bf0bcd5f1d3e4 /db
parent4eeb51dc71062fa2eac828c6030388d354179efc (diff)
downloadgitlab-ce-9c811566f85d18bc9eb4a85c6a343cf1bfa4fbd2.tar.gz
Revert add action column changes
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/14_pipelines.rb8
-rw-r--r--db/fixtures/development/19_environments.rb20
-rw-r--r--db/migrate/20181030150739_add_action_to_deployments.rb24
-rw-r--r--db/migrate/20181106135939_add_index_to_deployments.rb29
-rw-r--r--db/schema.rb47
5 files changed, 31 insertions, 97 deletions
diff --git a/db/fixtures/development/14_pipelines.rb b/db/fixtures/development/14_pipelines.rb
index e4272cbee33..5af77c49913 100644
--- a/db/fixtures/development/14_pipelines.rb
+++ b/db/fixtures/development/14_pipelines.rb
@@ -43,14 +43,12 @@ class Gitlab::Seeder::Pipelines
# deploy stage
{ name: 'staging', stage: 'deploy', environment: 'staging', status_event: :success,
- options: { environment: { name: 'staging', action: 'start', on_stop: 'stop staging' } },
+ options: { environment: { action: 'start', on_stop: 'stop staging' } },
queued_at: 7.hour.ago, started_at: 6.hour.ago, finished_at: 4.hour.ago },
{ name: 'stop staging', stage: 'deploy', environment: 'staging',
- when: 'manual', status: :skipped,
- options: { environment: { name: 'staging', action: 'stop' } } },
+ when: 'manual', status: :skipped },
{ name: 'production', stage: 'deploy', environment: 'production',
- when: 'manual', status: :skipped,
- options: { environment: { name: 'production' } } },
+ when: 'manual', status: :skipped },
# notify stage
{ name: 'slack', stage: 'notify', when: 'manual', status: :success },
diff --git a/db/fixtures/development/19_environments.rb b/db/fixtures/development/19_environments.rb
index 031a04ac76b..3e227928a29 100644
--- a/db/fixtures/development/19_environments.rb
+++ b/db/fixtures/development/19_environments.rb
@@ -45,18 +45,14 @@ class Gitlab::Seeder::Environments
end
def create_deployment!(project, name, ref, sha)
- find_deployable(project, name).try do |deployable|
- environment = find_or_create_environment!(project, name)
- environment.deployments.create!(
- project: project,
- ref: ref,
- sha: sha,
- tag: false,
- deployable: deployable
- ).tap do |deployment|
- deployment.succeed!
- end
- end
+ environment = find_or_create_environment!(project, name)
+ environment.deployments.create!(
+ project: project,
+ ref: ref,
+ sha: sha,
+ tag: false,
+ deployable: find_deployable(project, name)
+ )
end
def find_or_create_environment!(project, name)
diff --git a/db/migrate/20181030150739_add_action_to_deployments.rb b/db/migrate/20181030150739_add_action_to_deployments.rb
deleted file mode 100644
index a8c3a8ee69c..00000000000
--- a/db/migrate/20181030150739_add_action_to_deployments.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class AddActionToDeployments < ActiveRecord::Migration
- include Gitlab::Database::MigrationHelpers
-
- DEPLOYMENT_ACTION_START = 1 # Equivalent to Deployment.actions['start']
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:deployments,
- :action,
- :integer,
- limit: 2,
- default: DEPLOYMENT_ACTION_START,
- allow_null: false)
- end
-
- def down
- remove_column(:deployments, :action)
- end
-end
diff --git a/db/migrate/20181106135939_add_index_to_deployments.rb b/db/migrate/20181106135939_add_index_to_deployments.rb
index 47c704a03ae..999c4a9e575 100644
--- a/db/migrate/20181106135939_add_index_to_deployments.rb
+++ b/db/migrate/20181106135939_add_index_to_deployments.rb
@@ -4,27 +4,26 @@ class AddIndexToDeployments < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- SHORT_INDEX_NAME_FOR_ENVIRONMENT_ID = 'index_deployments_on_env_deployed_for_id'
- SHORT_INDEX_NAME_FOR_ENVIRONMENT_IID = 'index_deployments_on_env_deployed_for_iid'
- SHORT_INDEX_NAME_FOR_PROJECT_FINISHED_AT = 'index_deployments_on_prj_deployed_for_finished_at'
disable_ddl_transaction!
def up
- add_concurrent_index :deployments, [:project_id, :action, :status, :id]
- add_concurrent_index :deployments, [:project_id, :action, :status, :iid]
- add_concurrent_index :deployments, [:project_id, :action, :status, :finished_at], name: SHORT_INDEX_NAME_FOR_PROJECT_FINISHED_AT
- add_concurrent_index :deployments, [:environment_id, :action, :status, :id], name: SHORT_INDEX_NAME_FOR_ENVIRONMENT_ID
- add_concurrent_index :deployments, [:environment_id, :action, :status, :iid], name: SHORT_INDEX_NAME_FOR_ENVIRONMENT_IID
- add_concurrent_index :deployments, [:environment_id, :action, :sha]
+ remove_concurrent_index :deployments, [:project_id, :status]
+ remove_concurrent_index :deployments, [:environment_id, :status]
+ add_concurrent_index :deployments, [:project_id, :status, :id]
+ add_concurrent_index :deployments, [:project_id, :status, :iid]
+ add_concurrent_index :deployments, [:environment_id, :status, :id]
+ add_concurrent_index :deployments, [:environment_id, :status, :iid]
+ add_concurrent_index :deployments, [:environment_id, :sha]
end
def down
- remove_concurrent_index :deployments, [:project_id, :action, :status, :id]
- remove_concurrent_index :deployments, [:project_id, :action, :status, :iid]
- remove_concurrent_index_by_name(:deployments, SHORT_INDEX_NAME_FOR_PROJECT_FINISHED_AT)
- remove_concurrent_index_by_name(:deployments, SHORT_INDEX_NAME_FOR_ENVIRONMENT_ID)
- remove_concurrent_index_by_name(:deployments, SHORT_INDEX_NAME_FOR_ENVIRONMENT_IID)
- remove_concurrent_index :deployments, [:environment_id, :action, :sha]
+ add_concurrent_index :deployments, [:project_id, :status]
+ add_concurrent_index :deployments, [:environment_id, :status]
+ remove_concurrent_index :deployments, [:project_id, :status, :id]
+ remove_concurrent_index :deployments, [:project_id, :status, :iid]
+ remove_concurrent_index :deployments, [:environment_id, :status, :id]
+ remove_concurrent_index :deployments, [:environment_id, :status, :iid]
+ remove_concurrent_index :deployments, [:environment_id, :sha]
end
end
diff --git a/db/schema.rb b/db/schema.rb
index ae9b1f24a4b..d31f6f09b78 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -827,23 +827,19 @@ ActiveRecord::Schema.define(version: 20181106135939) do
t.string "on_stop"
t.integer "status", limit: 2, default: 2, null: false
t.datetime_with_timezone "finished_at"
- t.integer "action", limit: 2, default: 1, null: false
end
add_index "deployments", ["created_at"], name: "index_deployments_on_created_at", using: :btree
add_index "deployments", ["deployable_type", "deployable_id"], name: "index_deployments_on_deployable_type_and_deployable_id", using: :btree
- add_index "deployments", ["environment_id", "action", "sha"], name: "index_deployments_on_environment_id_and_action_and_sha", using: :btree
- add_index "deployments", ["environment_id", "action", "status", "id"], name: "index_deployments_on_env_deployed_for_id", using: :btree
- add_index "deployments", ["environment_id", "action", "status", "iid"], name: "index_deployments_on_env_deployed_for_iid", using: :btree
add_index "deployments", ["environment_id", "id"], name: "index_deployments_on_environment_id_and_id", using: :btree
add_index "deployments", ["environment_id", "iid", "project_id"], name: "index_deployments_on_environment_id_and_iid_and_project_id", using: :btree
- add_index "deployments", ["environment_id", "status"], name: "index_deployments_on_environment_id_and_status", using: :btree
+ add_index "deployments", ["environment_id", "sha"], name: "index_deployments_on_environment_id_and_sha", using: :btree
+ add_index "deployments", ["environment_id", "status", "id"], name: "index_deployments_on_environment_id_and_status_and_id", using: :btree
+ add_index "deployments", ["environment_id", "status", "iid"], name: "index_deployments_on_environment_id_and_status_and_iid", using: :btree
add_index "deployments", ["id"], name: "partial_index_deployments_for_legacy_successful_deployments", where: "((finished_at IS NULL) AND (status = 2))", using: :btree
- add_index "deployments", ["project_id", "action", "status", "finished_at"], name: "index_deployments_on_prj_deployed_for_finished_at", using: :btree
- add_index "deployments", ["project_id", "action", "status", "id"], name: "index_deployments_on_project_id_and_action_and_status_and_id", using: :btree
- add_index "deployments", ["project_id", "action", "status", "iid"], name: "index_deployments_on_project_id_and_action_and_status_and_iid", using: :btree
add_index "deployments", ["project_id", "iid"], name: "index_deployments_on_project_id_and_iid", unique: true, using: :btree
- add_index "deployments", ["project_id", "status"], name: "index_deployments_on_project_id_and_status", using: :btree
+ add_index "deployments", ["project_id", "status", "id"], name: "index_deployments_on_project_id_and_status_and_id", using: :btree
+ add_index "deployments", ["project_id", "status", "iid"], name: "index_deployments_on_project_id_and_status_and_iid", using: :btree
create_table "emails", force: :cascade do |t|
t.integer "user_id", null: false
@@ -931,35 +927,6 @@ ActiveRecord::Schema.define(version: 20181106135939) do
add_index "forked_project_links", ["forked_to_project_id"], name: "index_forked_project_links_on_forked_to_project_id", unique: true, using: :btree
- create_table "gcp_clusters", force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "user_id"
- t.integer "service_id"
- t.integer "status"
- t.integer "gcp_cluster_size", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.boolean "enabled", default: true
- t.text "status_reason"
- t.string "project_namespace"
- t.string "endpoint"
- t.text "ca_cert"
- t.text "encrypted_kubernetes_token"
- t.string "encrypted_kubernetes_token_iv"
- t.string "username"
- t.text "encrypted_password"
- t.string "encrypted_password_iv"
- t.string "gcp_project_id", null: false
- t.string "gcp_cluster_zone", null: false
- t.string "gcp_cluster_name", null: false
- t.string "gcp_machine_type"
- t.string "gcp_operation_id"
- t.text "encrypted_gcp_token"
- t.string "encrypted_gcp_token_iv"
- end
-
- 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"
@@ -1860,6 +1827,7 @@ ActiveRecord::Schema.define(version: 20181106135939) do
end
add_index "redirect_routes", ["path"], name: "index_redirect_routes_on_path", unique: true, using: :btree
+ add_index "redirect_routes", ["path"], name: "index_redirect_routes_on_path_text_pattern_ops", using: :btree, opclasses: {"path"=>"varchar_pattern_ops"}
add_index "redirect_routes", ["source_type", "source_id"], name: "index_redirect_routes_on_source_type_and_source_id", using: :btree
create_table "releases", force: :cascade do |t|
@@ -2443,9 +2411,6 @@ ActiveRecord::Schema.define(version: 20181106135939) do
add_foreign_key "fork_network_members", "projects", on_delete: :cascade
add_foreign_key "fork_networks", "projects", column: "root_project_id", name: "fk_e7b436b2b5", on_delete: :nullify
add_foreign_key "forked_project_links", "projects", column: "forked_to_project_id", name: "fk_434510edb0", on_delete: :cascade
- 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