diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2017-04-28 06:46:15 +0000 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2017-07-20 09:56:52 +0100 |
commit | 72a85ae9ac2468b099a565d3848bf8e0dcdf4499 (patch) | |
tree | 9d95fe450c896cb4b80b19fd247eb5660fde2a2b /db | |
parent | 445cd22c72ca6fbfdcf18d67fa859c4b5b9e2a6c (diff) | |
download | gitlab-ce-72a85ae9ac2468b099a565d3848bf8e0dcdf4499.tar.gz |
Handle errors while a project is being deleted asynchronously.
1. Rescue all errors that `Projects::DestroyService` might throw, to prevent the
worker from leaving things in an inconsistent state
2. Unmark the project as `pending_delete`
3. Add a `delete_error` text column to `projects`, and save the error message in
there, to be shown to the project masters/owners.
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170428064307_add_column_delete_error_to_projects.rb | 31 | ||||
-rw-r--r-- | db/schema.rb | 1 |
2 files changed, 32 insertions, 0 deletions
diff --git a/db/migrate/20170428064307_add_column_delete_error_to_projects.rb b/db/migrate/20170428064307_add_column_delete_error_to_projects.rb new file mode 100644 index 00000000000..ef5fc2cdea5 --- /dev/null +++ b/db/migrate/20170428064307_add_column_delete_error_to_projects.rb @@ -0,0 +1,31 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddColumnDeleteErrorToProjects < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + # When a migration requires downtime you **must** uncomment the following + # constant and define a short and easy to understand explanation as to why the + # migration requires downtime. + # DOWNTIME_REASON = '' + + # When using the methods "add_concurrent_index", "remove_concurrent_index" or + # "add_column_with_default" you must disable the use of transactions + # as these methods can not run in an existing transaction. + # When using "add_concurrent_index" or "remove_concurrent_index" methods make sure + # that either of them is the _only_ method called in the migration, + # any other changes should go in a separate migration. + # This ensures that upon failure _only_ the index creation or removing fails + # and can be retried or reverted easily. + # + # To disable transactions uncomment the following line and remove these + # comments: + # disable_ddl_transaction! + + def change + add_column :projects, :delete_error, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index 284b2068166..0ba2bd31517 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1134,6 +1134,7 @@ ActiveRecord::Schema.define(version: 20170717150329) do t.integer "cached_markdown_version" t.datetime "last_repository_updated_at" t.string "ci_config_path" + t.text "delete_error" end add_index "projects", ["ci_id"], name: "index_projects_on_ci_id", using: :btree |