diff options
Diffstat (limited to 'doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md')
-rw-r--r-- | doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md b/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md index 22d699b424b..9a23a115765 100644 --- a/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md +++ b/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md @@ -43,10 +43,13 @@ instance_of_object.method(:foo).source_location project.method(:private?).source_location ``` -## Query an object +## Query the database using an ActiveRecord Model ```ruby -o = Object.where('attribute like ?', 'ex') +m = Model.where('attribute like ?', 'ex%') + +# for example to query the projects +projects = Project.where('path like ?', 'Oumua%') ``` ## View all keys in cache @@ -215,6 +218,17 @@ namespace = Namespace.find_by_full_path("") ::Projects::TransferService.new(p, current_user).execute(namespace) ``` +### For Removing webhooks that is getting timeout due to large webhook logs + +```ruby +# ID will be the webhook_id +WebHookLog.where(web_hook_id: ID).each_slice(ID) do |slice| + slice.each(&:destroy) +end + +WebHook.find(ID).destroy +``` + ### Bulk update service integration password for _all_ projects For example, change the Jira user's password for all projects that have the Jira @@ -242,6 +256,18 @@ p.each do |project| end ``` +### Incorrect repository statistics shown in the GUI + +After [reducing a repository size with third-party tools](../../user/project/repository/reducing_the_repo_size_using_git.md) +the displayed size may still show old sizes or commit numbers. To force an update, do: + +```ruby +p = Project.find_by_full_path('<namespace>/<project>') +pp p.statistics +p.statistics.refresh! +pp p.statistics # compare with earlier values +``` + ## Wikis ### Recreate |