summaryrefslogtreecommitdiff
path: root/lib/gitlab/database
Commit message (Collapse)AuthorAgeFilesLines
* Fix TRIGGER checks for MySQLfix-mysql-grant-checkYorick Peterse2017-11-061-11/+19
| | | | | | | | | This ensures we can check if the user has TRIGGER permissions without querying restricted tables. Thanks to Steve Norman (https://gitlab.com/stevenorman) for helping out with this merge request. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/38372
* Merge branch 'mk-delete-conflicting-redirects-mysql' into 'master'Douwe Maan2017-09-181-0/+88
|\ | | | | | | | | | | | | Clean up redirect routes that conflict with regular routes Closes #36229 See merge request gitlab-org/gitlab-ce!13783
| * Spread out the work a littleMichael Kozono2017-09-141-3/+43
| |
| * Extract helper for queuing background jobsMichael Kozono2017-09-141-0/+48
| |
* | Fix setting share_with_group_lockfix-share-with-group-lock-updateYorick Peterse2017-09-151-0/+16
|/ | | | | | | | | | | | | | | | | | | Prior to this commit running Namespace#force_share_with_group_lock_on_descendants would result in updating _all_ namespaces in the namespaces table, not just the descendants. This is the result of ActiveRecord::Relation#update_all not taking into account the CTE. To work around this we use the CTE query as a sub-query instead of directly calling #update_all. To prevent this from happening the relations returned by Gitlab::GroupHierarchy are now marked as read-only, resulting in an error being raised when methods such as #update_all are used. Fortunately on GitLab.com our statement timeouts appear to have prevented this query from actually doing any damage other than causing a very large amount of dead tuples. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/37916
* Improve migrations using triggerscheck-trigger-permissions-mysqlYorick Peterse2017-08-292-4/+66
| | | | | | | | | | | | | | | | 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 permission). Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/36633
* Fix invalid default argument in migration helpersGrzegorz Bizon2017-08-231-1/+1
|
* Add Sidekiq migration helpers for migrating queuesGrzegorz Bizon2017-08-221-0/+14
|
* Fix Error 500s when attempting to destroy a protected tagStan Hu2017-08-201-0/+5
| | | | | | | | | | | | | | | Due to a missing `on_delete: :cascade`, users would hit the error that looked like: ``` PG::ForeignKeyViolation: ERROR: update or delete on table "protected_tags" violates foreign key constraint "fk_rails_f7dfda8c51" on table "protected_tag_create_access_levels" DETAIL: Key (id)=(1385) is still referenced from table "protected_tag_create_access_levels". : DELETE FROM "protected_tags" WHERE "protected_tags"."id" = 1385 ``` Closes #36013
* Add a foreign key to `merge_requests.head_pipeline_id`Grzegorz Bizon2017-07-181-1/+3
|
* Support multiple Redis instances based on queue typePaul Charlton2017-07-111-2/+2
|
* Added code for defining SHA attributesYorick Peterse2017-06-291-0/+34
| | | | | | These attributes are stored in binary in the database, but exposed as strings. This allows one to query/create data using plain SHA1 hashes as Strings, while storing them more efficiently as binary.
* Adjust for new static-analysis failuresbvl-rename-all-reserved-paths-mysqlBob Van Landuyt2017-06-271-2/+2
|
* Only do one query for updating routesBob Van Landuyt2017-06-271-5/+15
|
* Update routes directly by ID instead of filtering by pathBob Van Landuyt2017-06-261-4/+12
|
* Clear the cache for projects one-by-oneBob Van Landuyt2017-06-261-14/+16
|
* Add punctuation to log messagesBob Van Landuyt2017-06-263-4/+6
|
* Keep failed renames in redisBob Van Landuyt2017-06-261-1/+13
|
* Use the migration name as a key in redisBob Van Landuyt2017-06-261-1/+1
|
* Don't break rolling back when a namespace or project was renamedBob Van Landuyt2017-06-262-5/+7
|
* More logging so we know we have the rename in redisBob Van Landuyt2017-06-261-1/+5
|
* Revert renames from a migrationBob Van Landuyt2017-06-261-0/+5
|
* Revert namespace renamesBob Van Landuyt2017-06-262-1/+23
|
* Add methods to revert project renamesBob Van Landuyt2017-06-262-6/+49
|
* Track all renames in redisBob Van Landuyt2017-06-263-0/+9
|
* Merge branch 'master' into fix/gb/improve-updating-column-in-batches-helperGrzegorz Bizon2017-06-224-35/+35
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (56 commits) File view buttons Don't reset the session when the example failed, because we need capybara-screenshot to have access to it Resolve "MR comment + system note highlight don't have the same width" Add feature spec for dashboard state filter tabs Wording of Mysql support. a new feature checklist and more elaborate documentation requirements Filter archived project in API v3 only if param present Revert to using links instead of buttons in Issuable Index tabs. Do not run the codeclimate job on docs-only changes Only show gray footer space if environment actions exist Migrate Gitlab::Git::Blob.find to Gitaly Backport filtered search lazy token consistent state fix Add a comment explaining how the branch clean up happens Fix Github::Representation::PullRequest#source_branch_exists? Add CHANGELOG Fix GitHub importer performance on branch existence check Rebuild the dynamic path before validating it Rename stage ref migration specs to match a class name Enable Style/DotPosition Rubocop :cop: Revert "Merge branch 'winh-merge-request-related-issues' into 'master'" ... Conflicts: db/post_migrate/20170526185921_migrate_build_stage_reference.rb
| * Enable Style/DotPosition Rubocop :cop:Grzegorz Bizon2017-06-214-35/+35
| |
* | Raise if updating columns in batches within a transactionGrzegorz Bizon2017-06-211-0/+6
|/
* Put an upper limit on update batchesupdate-column-in-batches-batch-sizeYorick Peterse2017-06-191-0/+6
| | | | | | | When using update_column_in_batches the upper limit on the batch size is now 1000. This ensures that for very large tables we don't lock tens of thousands of rows during the update. This in turn should reduce the likelyhood of running into deadlocks.
* Add database helpers 'add_timestamps_with_timezone' and ↵32054-rails-should-use-timestamptz-database-type-for-postgresqlblackst0ne2017-06-131-0/+33
| | | | 'timestamps_with_timezone'
* Only use DROP INDEX CONCURRENTLY on postgreql 9.2+Nick Thomas2017-05-251-1/+34
|
* Fixes for the rename reserved paths helpersBob Van Landuyt2017-05-183-1/+16
|
* Disallow NULL on renamed column after default has been setDouwe Maan2017-05-151-1/+2
|
* Merge branch 'rename-column-concurrently-defaults' into 'master' Rémy Coutable2017-05-151-1/+5
|\ | | | | | | | | Fix adding defaults for concurrent column renames See merge request !11335
| * Fix adding defaults for concurrent column renamesrename-column-concurrently-defaultsYorick Peterse2017-05-121-1/+5
| | | | | | | | | | | | By adding the default value _after_ adding the column we avoid updating all rows in a table, saving a lot of time and unnecessary work in the process.
* | Update rename_base.rbJames Lopez2017-05-121-1/+1
| |
* | Only rename namespaces and projects with an invalid pathBob Van Landuyt2017-05-121-1/+1
|/ | | | For exact matches, not namespaces that end with an invalid path
* Add a new column before creating rename triggersBob Van Landuyt2017-05-111-10/+10
| | | | | | | | | | | | | | | MySQL doesn't allow us to create a trigger for a column that doesn't exist yet. Failing with this error: ``` Mysql2::Error: Unknown column 'build_events' in 'NEW': CREATE TRIGGER trigger_6a80c097c862_insert BEFORE INSERT ON `services` FOR EACH ROW SET NEW.`build_events` = NEW.`job_events` ``` Creating the new column before creating the trigger avoids this.
* Update commentsBob Van Landuyt2017-05-021-0/+8
|
* Rename child namespaces in migrationhelpersBob Van Landuyt2017-05-012-2/+7
|
* Clear html cache for a projects milestonesBob Van Landuyt2017-05-011-0/+4
|
* Remove dependecy on `User`Bob Van Landuyt2017-05-011-20/+0
|
* Move ReservedPathsMigration into V1 namespaceBob Van Landuyt2017-05-0110-352/+362
|
* Minor style adjustmentsBob Van Landuyt2017-05-011-3/+4
|
* Clear cached markdown after renaming projectsBob Van Landuyt2017-05-013-3/+24
|
* Rename Projects & Namespaces based on entire pathsBob Van Landuyt2017-05-013-8/+13
|
* Use objects for renaming namespaces and projectsBob Van Landuyt2017-05-015-100/+119
|
* Rename projects in a migrationhelperBob Van Landuyt2017-05-013-23/+74
|
* Make renaming records in the database reusableBob Van Landuyt2017-05-013-48/+71
| | | | So we can use it for projects
* Rename namespace-paths in a migration helperBob Van Landuyt2017-05-013-0/+232
|