Commit Graph

107 Commits

Author SHA1 Message Date
GitLab Bot 71da5de44f Add latest changes from gitlab-org/gitlab@master 2020-08-05 15:09:59 +00:00
GitLab Bot 3261f18a4b Add latest changes from gitlab-org/gitlab@master 2020-07-24 03:09:19 +00:00
GitLab Bot b0da29fca9 Add latest changes from gitlab-org/gitlab@master 2020-07-16 00:09:17 +00:00
GitLab Bot ce06ce825b Add latest changes from gitlab-org/gitlab@master 2020-07-06 15:08:42 +00:00
GitLab Bot 082b24b03b Add latest changes from gitlab-org/gitlab@master 2020-06-24 00:08:43 +00:00
GitLab Bot ea054ec1c3 Add latest changes from gitlab-org/gitlab@master 2020-06-09 12:08:55 +00:00
GitLab Bot c4c1fc5fe7 Add latest changes from gitlab-org/gitlab@master 2020-05-15 15:08:04 +00:00
GitLab Bot e689e858ed Add latest changes from gitlab-org/gitlab@master 2020-05-13 18:08:47 +00:00
GitLab Bot ae69a88c2a Add latest changes from gitlab-org/gitlab@master 2020-05-08 03:09:54 +00:00
GitLab Bot 56df7f06f1 Add latest changes from gitlab-org/gitlab@master 2020-04-28 00:09:33 +00:00
GitLab Bot 45999bfdec Add latest changes from gitlab-org/gitlab@master 2020-04-27 12:09:41 +00:00
GitLab Bot db061f4432 Add latest changes from gitlab-org/gitlab@master 2020-04-22 18:09:52 +00:00
GitLab Bot e33f87ac0f Add latest changes from gitlab-org/gitlab@master 2020-04-21 15:21:10 +00:00
GitLab Bot 602ea42669 Add latest changes from gitlab-org/gitlab@master 2020-04-13 21:09:38 +00:00
GitLab Bot e80e0dd64f Add latest changes from gitlab-org/gitlab@master 2020-03-26 15:08:16 +00:00
GitLab Bot c4db541c1b Add latest changes from gitlab-org/gitlab@master 2020-03-24 21:07:54 +00:00
GitLab Bot 42263d6451 Add latest changes from gitlab-org/gitlab@master 2020-03-02 00:07:41 +00:00
GitLab Bot a6c2be7cd2 Add latest changes from gitlab-org/gitlab@master 2020-02-21 21:08:57 +00:00
GitLab Bot a53d2c37c4 Add latest changes from gitlab-org/gitlab@master 2020-02-21 09:09:01 +00:00
GitLab Bot 33795139ea Add latest changes from gitlab-org/gitlab@master 2020-02-19 18:09:10 +00:00
GitLab Bot 6b9d3a4e83 Add latest changes from gitlab-org/gitlab@master 2020-01-29 18:08:47 +00:00
GitLab Bot 6315ed9630 Add latest changes from gitlab-org/gitlab@master 2020-01-28 18:08:35 +00:00
GitLab Bot d65442b1d9 Add latest changes from gitlab-org/gitlab@master 2020-01-23 00:08:53 +00:00
GitLab Bot a7df1d8717 Add latest changes from gitlab-org/gitlab@master 2020-01-08 15:08:01 +00:00
GitLab Bot 015663b70f Add latest changes from gitlab-org/gitlab@master 2020-01-06 21:07:43 +00:00
GitLab Bot badb9c1dea Add latest changes from gitlab-org/gitlab@master 2019-12-17 12:08:11 +00:00
GitLab Bot bffcdf9bca Add latest changes from gitlab-org/gitlab@master 2019-12-02 12:06:45 +00:00
GitLab Bot 69944ffb68 Add latest changes from gitlab-org/gitlab@master 2019-11-12 15:06:26 +00:00
GitLab Bot 4c464055fb Add latest changes from gitlab-org/gitlab@master 2019-11-05 15:06:17 +00:00
GitLab Bot 0a850868df Add latest changes from gitlab-org/gitlab@master 2019-10-09 12:06:13 +00:00
Reuben Pereira 43d33ef824 Refactor new undo_* methods
- Move code for creating a new column from old into a function so that
it can be reused.
- Also add comments above the methods.
2019-09-05 12:15:16 +00:00
Reuben Pereira f855f9b815 Add helper to exactly undo cleanup_concurrent_column_rename
- Also add helper to undo rename_column_concurrently.
2019-08-25 20:14:52 +00:00
Reuben Pereira 599cc49973 Drop existing trigger before creating new one
- 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.
2019-08-24 04:20:29 +00:00
Andreas Brandl 988dc80585
Further remove code branches by database type
We dropped MySQL support and a lot of mysql specific code has been
removed in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/29608.

This comes in from the other direction and removes any `if postgresql?`
branches.
2019-07-29 12:47:06 +02:00
Nick Thomas 4aa76dddec
Remove dead MySQL code
None of this code can be reached any more, so it can all be removed
2019-07-23 16:53:03 +01:00
Alex Kalderimis eda789c3c2 Improves add_timestamps_with_timezone helper
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.
2019-07-18 15:47:01 +00:00
Mayra Cabrera 0ab89d8e36 Add a rubocop for Rails.logger
Suggests to use a JSON structured log instead

Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/54102
2019-07-10 19:26:47 +00:00
Jason Goodman 96b116d099 Support jsonb Default Value in add_column_with_default Migration Helper 2019-06-28 04:48:57 +00:00
pjaspers 6f5daf49d9 Use correct arg name
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)
2019-06-19 13:55:47 +02:00
pjaspers 31438ddd8b Fix syntax coloring on emacs
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!
2019-06-19 12:36:32 +02:00
Yorick Peterse 0f777a8d49
Allow custom names for concurrent foreign keys
This is necessary for backporting the EE schema to ensure backported
foreign keys use the same key names.
2019-06-17 17:06:20 +02:00
Lin Jen-Shin 24eff5e083 Add remove_foreign_key_if_exists 2019-05-07 15:38:43 +08:00
Heinrich Lee Yu a8a4518099 Clean up `noteable_id` for notes on commits
This was incorrectly set by a bug in:
https://gitlab.com/gitlab-org/gitlab-ce/issues/54924

Also adds a `batch_size` option to `update_column_in_batches`
2019-04-06 08:29:51 +08:00
Jasper Maes 56296f1eda Remove rails4 specific code 2018-12-16 10:48:41 +01:00
Rubén Dávila b2cf4b9525 Backports some changes from gitlab-ee!7885 2018-12-07 08:29:53 -05:00
gfyoung 7e6f6e1603 Enable even more frozen string in lib/gitlab
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.
2018-11-06 22:47:32 -08:00
George Tsiolis 733ae94921 Fix typos in comments and specs 2018-11-01 08:59:20 +02:00
Andreas Brandl a84469a345 Merge branch 'mysql-migration-trigger-permissions' into 'master'
Add dbname to MySQL migration GRANT command

See merge request gitlab-org/gitlab-ce!21719
2018-10-23 12:30:14 +00:00
Dmitriy Zaporozhets 9ab3e6093c
Add mysql_compatible_index_length to migration helpers
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2018-09-21 13:23:29 +03:00
Ryan Hefner 2906e09f3a Add dbname to MySQL migration GRANT command 2018-09-13 16:27:57 +02:00