1. 12 Jul, 2019 2 commits
  2. 10 Jul, 2019 1 commit
  3. 28 Jun, 2019 2 commits
  4. 25 Jun, 2019 4 commits
  5. 21 Mar, 2019 1 commit
  6. 14 Mar, 2019 1 commit
  7. 12 Feb, 2019 2 commits
    • Stan Hu's avatar
    • Stan Hu's avatar
      Kill all PostgreSQL connections for rake dev:setup · 5488e8a4
      Stan Hu authored
      If there are any clients connected to the DB, PostgreSQL won't let you
      drop the database. It's possible that Sidekiq, Unicorn, or some other
      client will be hanging onto a connection, preventing the DROP DATABASE
      from working. To workaround this problem, this method cancels all the
      connections so that the db:reset command will work.
      Note that there's still a slight possibility a client connects after its
      connection is terminated. If this is an issue, we could solve it by
      revoking CONNECT access, but for now it seems this works.
      Closes gitlab-development-kit#450
  8. 16 Dec, 2018 1 commit
  9. 26 Nov, 2018 1 commit
  10. 22 Oct, 2018 1 commit
  11. 12 Sep, 2018 1 commit
  12. 24 Jul, 2018 1 commit
  13. 06 Jul, 2018 1 commit
  14. 14 Jun, 2018 1 commit
  15. 17 May, 2018 1 commit
  16. 15 Mar, 2018 2 commits
  17. 05 Dec, 2017 1 commit
  18. 01 Dec, 2017 2 commits
  19. 07 Nov, 2017 1 commit
    • Yorick Peterse's avatar
      Add returning IDs to Gitlab::Database.bulk_insert · bda30182
      Yorick Peterse authored
      This adds the keyword argument "return_ids" to
      Gitlab::Database.bulk_insert. When set to `true` (and PostgreSQL is
      used) this method will return an Array of the IDs of the inserted rows,
      otherwise it will return an empty Array.
  20. 31 Oct, 2017 1 commit
  21. 06 Oct, 2017 1 commit
    • to1ne's avatar
      Create idea of read-only database · d1366971
      to1ne authored
      In GitLab EE, a GitLab instance can be read-only (e.g. when it's a Geo
      secondary node). But in GitLab CE it also might be useful to have the
      "read-only" idea around. So port it back to GitLab CE.
      Also having the principle of read-only in GitLab CE would hopefully
      lead to less errors introduced, doing write operations when there
      aren't allowed for read-only calls.
      Closes gitlab-org/gitlab-ce#37534.
  22. 29 Aug, 2017 1 commit
    • Yorick Peterse's avatar
      Improve migrations using triggers · 5eab624d
      Yorick Peterse authored
      This adds a bunch of checks to migrations that may create or drop
      triggers. Dropping triggers/functions is done using "IF EXISTS" so we
      don't throw an error if the object in question has already been dropped.
      We now also raise a custom error (message) when the user does not have
      TRIGGER privileges. This should prevent the schema from entering an
      inconsistent state while also providing the user with enough information
      on how to solve the problem.
      The recommendation of using SUPERUSER permissions is a bit extreme but
      we require this anyway (Omnibus also configures users with this
      Fixes #36633
  23. 10 Aug, 2017 1 commit
    • Yorick Peterse's avatar
      Use a specialized class for querying events · aac1de46
      Yorick Peterse authored
      This changes various controllers to use the new EventCollection class
      for retrieving events. This class uses a JOIN LATERAL query on
      PostgreSQL to retrieve queries in a more efficient way, while falling
      back to a simpler / less efficient query for MySQL.
      The EventCollection class also includes a limit on the number of events
      to display to prevent malicious users from cycling through all events,
      as doing so could put a lot of pressure on the database.
      JOIN LATERAL is only supported on PostgreSQL starting with version 9.3.0
      and as such this optimisation is only used when using PostgreSQL 9.3 or
  24. 26 Jun, 2017 1 commit
  25. 16 Jun, 2017 1 commit
    • Sean McGivern's avatar
      Add table for files in merge request diffs · 9a73b634
      Sean McGivern authored
      This adds an ID-less table containing one row per file, per merge request
      diff. It has a column for each attribute on Gitlab::Git::Diff that is serialised
      currently, with the advantage that we can easily query the attributes of this
      new table.
      It does not migrate existing data, so we have fallback code when the legacy
      st_diffs column is present instead. For a merge request diff to be valid, it
      should have at most one of:
      * Rows in this new table, with the correct merge_request_diff_id.
      * A non-NULL st_diffs column.
      It may have neither, if the diff is empty.
  26. 11 Apr, 2017 1 commit
  27. 17 Mar, 2017 1 commit
    • Yorick Peterse's avatar
      Added Gitlab::Database.config · 9a20ff1c
      Yorick Peterse authored
      This returns the ActiveRecord configuration for the current environment.
      While CE doesn't use this very often, EE will use it in a few places for
      the database load balancing code. I'm adding this to CE so we don't end
      up with merge conflicts in this file.
  28. 02 Mar, 2017 1 commit
  29. 22 Feb, 2017 1 commit
    • Yorick Peterse's avatar
      Allow setting of a custom connection pool host · cf521c95
      Yorick Peterse authored
      This allows you to set a custom host when calling
      Gitlab::Database.create_connection_pool. This is necessary for load
      balancing as in this case we want to inherit all settings except for the
  30. 14 Feb, 2017 1 commit
  31. 13 Feb, 2017 2 commits