Skip to content
Snippets Groups Projects
  1. Feb 21, 2020
  2. Feb 19, 2020
  3. Jan 29, 2020
  4. Jan 28, 2020
  5. Jan 23, 2020
  6. Jan 08, 2020
  7. Jan 06, 2020
  8. Dec 17, 2019
  9. Dec 02, 2019
  10. Nov 12, 2019
  11. Nov 05, 2019
  12. Oct 09, 2019
  13. Sep 05, 2019
  14. Aug 25, 2019
  15. Aug 24, 2019
    • Reuben Pereira's avatar
      Drop existing trigger before creating new one · 599cc499
      Reuben Pereira authored
      - When renaming a column concurrently, drop any existing trigger before
      attempting to create a new one.
      
      When running migration specs multiple times (as it happens during
      local development), the down method of previous migrations are called.
      If any of the called methods contains a call to
      rename_column_concurrently, a trigger will be created and not removed.
      So, the next time a migration spec is run, if the same down method is
      executed again, it will cause an error when attempting to create the
      trigger (since it already exists). Dropping the trigger if it already
      exists will prevent this problem.
      599cc499
  16. Jul 29, 2019
  17. Jul 23, 2019
  18. Jul 18, 2019
    • Alexis Kalderimis's avatar
      Improves add_timestamps_with_timezone helper · eda789c3
      Alexis Kalderimis authored and Mayra Cabrera's avatar Mayra Cabrera committed
      This improves the `add_timestamps_with_timezone` helper by allowing the
      column names to be configured. This has the advantage that unnecessary
      columns can be avoided, saving space.
      
      A helper for removing the columns is also provided, to be used in the
      `down` method of migrations.
      eda789c3
  19. Jul 10, 2019
  20. Jun 28, 2019
  21. Jun 19, 2019
    • pjaspers's avatar
      Use correct arg name · 6f5daf49
      pjaspers authored
      So funny story, true story. I tried to run the test locally, but
      didn't make it past setting up Gitaly.
      
      Here's what I tried:
      
      First attempt:
      
      `git clone gitlab-ce`
      `cd gitlab-ce && bundle install`
      `be rspec`
      
      This didn't work because I was missing the config/database.yml, I
      didn't see a `script/bootstrap` so I looked in the readme which
      redirected me to a webpage which redirected me to the
      gitlab-development-kit.
      
      Second attempt:
      
      `gem install gitlab-development-kit`
      cd gitlab-development-kit
      gdk init
      gdk isntall
      
      This broke somwhere along the way because it couldn't install Gitaly
      because my go version was too low. But it did clone the gitlab repo
      again and this time it did have a config/database.yml.
      
      So I tried to cd into it and `be rspec
      spec/lib/gitlab/database/migration_helpers_spec.rb` which complained
      about the database not being configured so I:
      
      - Changed the socket to localhost (in the config/database.yml)
      - `createdb <dev_db>` `createdb test_db`
      - `be rake db:test:prepare`
      
      Great success, it was doing things! But then failed when it came at
      the Gitaly step.
      
      Since I only want to change these three lines, at the point I gave up
      and entrusted the pipeline to do its thing.
      
      What I would have liked:
      
      - A 'It's a Rails system, I know this' readme/docs (It's in there
        somewhere just couldn't find it)
      - A way to run tests without having to use Gitaly
      - Not having too install all the things for a small fix (I get why'd
        you want this, but to me it's overkill)
      6f5daf49
    • pjaspers's avatar
      Fix syntax coloring on emacs · 31438ddd
      pjaspers authored
      The rather cryptic:
      
            "fk_#{Digest::SHA256.hexdigest("#{table}_#{column}_fk").first(10)}"
      
      Was too much for emacs too handle*, since it was coming from the Rails
      codebase I took their way of doing the same thing and applied it here.
      
      I think it's easier to read and it also makes emacs render the
      migration helpers pretty again.
      
      * not true, emacs can handle anything, leave emacs alone!
      31438ddd
  22. Jun 17, 2019
  23. May 07, 2019
  24. Apr 06, 2019
  25. Feb 14, 2019
  26. Feb 12, 2019
  27. Feb 11, 2019
    • Felipe Artur's avatar
      Migrate issuable states to integer patch 1 · e9b84f50
      Felipe Artur authored
      Patch 1 that migrates issues/merge requests states from integer to string.
      On this commit we are only adding the state_id column and syncing it with a backgroud migration.
      
      On Patch 2 the code to use the new integer column will be deployed and the old column will be
      removed.
      e9b84f50
  28. Dec 16, 2018
  29. Dec 07, 2018
  30. Nov 07, 2018
    • gfyoung's avatar
      Enable even more frozen string in lib/gitlab · 7e6f6e16
      gfyoung authored
      Enables frozens string for the following:
      
      * lib/gitlab/conflict/**/*.rb
      * lib/gitlab/cross_project_access/**/*.rb
      * lib/gitlab/cycle_analytics/**/*.rb
      * lib/gitlab/data_builder/**/*.rb
      * lib/gitlab/database/**/*.rb
      * lib/gitlab/dependency_linker/**/*.rb
      * lib/gitlab/diff/**/*.rb
      * lib/gitlab/downtime_check/**/*.rb
      * lib/gitlab/email/**/*.rb
      * lib/gitlab/etag_caching/**/*.rb
      
      Partially addresses gitlab-org/gitlab-ce#47424.
      7e6f6e16
  31. Nov 01, 2018
  32. Sep 21, 2018
  33. Sep 13, 2018
  34. Aug 11, 2018
  35. Aug 10, 2018
  36. Aug 06, 2018
    • Yorick Peterse's avatar
      Respond to DB health in background migrations · 91b752dc
      Yorick Peterse authored
      This changes the BackgroundMigration worker so it checks for the health
      of the DB before performing a background migration. This in turn allows
      us to reduce the minimum interval, without having to worry about blowing
      things up if we schedule too many migrations.
      
      In this setup, the BackgroundMigration worker will reschedule jobs as
      long as the database is considered to be in an unhealthy state. Once the
      database has recovered, the migration can be performed.
      
      To determine if the database is in a healthy state, we look at the
      replication lag of any replication slots defined on the primary. If the
      lag is deemed to great (100 MB by default) for too many slots, the
      migration is rescheduled for a later point in time.
      
      The health checking code is hidden behind a feature flag, allowing us to
      disable it if necessary.
      Unverified
      91b752dc
  37. Jun 26, 2018
  38. Apr 29, 2018
    • blackst0ne's avatar
      [Rails5] Fix Arel::UpdateManager · 54124fc6
      blackst0ne authored
      In Arel 7.0.0 (Arel 7.1.4 is used in Rails 5.0) the `engine` parameter
      of `Arel::UpdateManager#initializer` was removed.
      
      This commit makes the gitlab database helpers work both in rails 4 and
      rails 5.
      Fixes errors like this one:
      
      ```
      1) Gitlab::Database::MigrationHelpers#update_column_in_batches when running outside of a transaction updates all the rows in a table
          Failure/Error:
            update_arel = Arel::UpdateManager.new(ActiveRecord::Base)
              .table(table)
              .set([[table[column], value]])
              .where(table[:id].gteq(start_id))
      
          ArgumentError:
            wrong number of arguments (given 1, expected 0)
          # ./lib/gitlab/database/migration_helpers.rb:317:in `new'
          # ./lib/gitlab/database/migration_helpers.rb:317:in `block in update_column_in_batches'
          # ./lib/gitlab/database/migration_helpers.rb:307:in `loop'
          # ./lib/gitlab/database/migration_helpers.rb:307:in `update_column_in_batches'
          # ./spec/lib/gitlab/database/migration_helpers_spec.rb:367:in `block (4 levels) in <top (required)>'
      ```
      54124fc6
Loading