summaryrefslogtreecommitdiff
path: root/spec/migrations
Commit message (Collapse)AuthorAgeFilesLines
* Migrations for adding issue_id to versions tableLuke Duncalfe2019-07-291-0/+38
| | | | | | | | | | | | | | These migrations do the following: - Adds a new `issue_id` column to `versions`. This fixes an n+1 problem when loading versions for an issue in GraphQL as AR can now load from cache - Change the unique restraint on versions.sha to be scoped to `issue_id` as in order to import version data, we need to allow duplicate `sha` values for versions - Update all versions with an `issue_id` https://gitlab.com/gitlab-org/gitlab-ee/issues/11090
* Add default for outbound_local_requests_whitelistThong Kuah2019-07-251-0/+21
| | | | It needs to default to an empty array logically.
* Fix wrong pages access level defaultVladimir Shushlin2019-07-171-0/+97
| | | | | - Set access level in before_validation hook - Add post migration for updating existing project_features
* Upgrade to Rails 5.2upgrade-rails-5-2-ceHeinrich Lee Yu2019-07-121-1/+1
| | | | Updates changed method names and fixes spec failures
* Change occurrence of Sidekiq::Testing.inline!Reuben Pereira2019-07-031-1/+1
| | | | - Change it to perform_enqueued_jobs
* Merge branch '44990-remove-old-i' into 'master'Nick Thomas2019-07-031-21/+0
|\ | | | | | | | | Remove old migration specs that violate FactoriesInMigrationSpecs See merge request gitlab-org/gitlab-ce!30280
| * Remove old migrations and specs44990-remove-old-iHeinrich Lee Yu2019-07-031-21/+0
| | | | | | | | | | This removes old migrations that violate the FactoriesinMigrationSpecs cop
* | Show upcoming status for releasesJason Goodman2019-07-031-0/+28
|/ | | | | | Add released_at field to releases API Add released_at column to releases table Return releases to the API sorted by released_at
* Remove migration specs from 201[4567]Nick Thomas2019-07-0246-2948/+0
| | | | Since the migrations are gone, we don't need these specs either
* Prevent EE backport migrations from running if CE is not migratedsh-recover-ee-schema-backport-migration-failureStan Hu2019-06-251-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a user upgraded to any GitLab 11.x EE version but switched back to CE, it's possible the state of the EE tables are not in the right state for the EE backport migration to work properly. In particular, there were three tables that had trouble: * epics * geo_event_log * vulnerability_feedback The EE backport migration would fail while trying to add foreign key constraints because a key didn't exist in the table. This happens because any EE migration that add or removed columns between v11.0.0 and v11.11.3 are not guaranteed to be applied in an CE installation. The EE backport schema does not individually backport these migrations. We now check if certain columns are present to determine whether the backport migration is in the proper state. CE users are required to upgrade to v11.11.3 EE if they ever installed EE previously before they can go back to v12.x CE. Tested via: ``` git checkout -f v11.0.0-ee bundle exec rake db:reset git checkout .; git checkout -f v11.11.3 bundle exec rake db:migrate git checkout .; git checkout -f v12.0.0 bundle exec rake db:migrate <failure happens> ```
* Merge branch 'sync-merge-ref-upon-mergeability-check' into 'master'Douwe Maan2019-06-241-0/+52
|\ | | | | | | | | Automatically update MR merge-ref along merge status See merge request gitlab-org/gitlab-ce!29569
| * Automatically update MR merge-ref along merge statusOswaldo Ferreira2019-06-201-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | This couples the code that transitions the `MergeRequest#merge_status` and refs/merge-requests/:iid/merge ref update. In general, instead of directly telling `MergeToRefService` to update the merge ref, we should rely on `MergeabilityCheckService` to keep both the merge status and merge ref synced. Now, if the merge_status is `can_be_merged` it means the merge-ref is also updated to the latest. We've also updated the logic to be more systematic and less user-based.
* | Merge branch '62772-migrate-managed-clusters-to-unmanaged' into 'master'Thong Kuah2019-06-211-0/+55
|\ \ | | | | | | | | | | | | | | | | | | Migrate managed clusters that aren't using managed features to unmanaged Closes #62772 See merge request gitlab-org/gitlab-ce!29251
| * | Migrate project level clusters with no Kubernetes namespace to unmanaged62772-migrate-managed-clusters-to-unmanagedTiger2019-06-141-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These clusters were created before we introduced the option to manage your own cluster, and not having a Kubernetes namespace present means that we have tried and failed to create one - and therefore we cannot manage your cluster for you. The 5 minute window should prevent a race condition where a cluster has only just been created and we haven't had a chance to create any resources for it yet.
* | | Migrate clusters with no token to unmanagedTiger2019-06-211-0/+59
| |/ |/| | | | | | | | | | | | | There are clusters that have Kubernetes namespaces stored which are missing a service account token. These namespaces are unable to be used for deployments, so marking the clusters as unmanaged will allow the platform credentials to be used instead.
* | Merge branch '57918-encrypt-feature-flags-tokens' into 'master'Kamil Trzciński2019-06-181-0/+36
|\ \ | | | | | | | | | | | | Add migrations needed to encrypt feature flags client tokens See merge request gitlab-org/gitlab-ce!29320
| * | Add migrations needed to encrypt feature flags client tokens57918-encrypt-feature-flags-tokensKrasimir Angelov2019-06-181-0/+36
| | | | | | | | | | | | | | | | | | | | | Make plaintext token column not null, add new token_encrypted column and index on project_id & token_encrypted. Post deployment migration to encrypt existing tokens.
* | | Merge branch 'migrate_k8s_service_integration' into 'master'Thong Kuah2019-06-171-0/+161
|\ \ \ | |/ / |/| | | | | | | | Migrate Kubernetes service integration templates to clusters See merge request gitlab-org/gitlab-ce!28534
| * | When an instance cluster already exists migrate disabledmigrate_k8s_service_integrationJames Fargher2019-05-301-0/+37
| | | | | | | | | | | | | | | | | | Assume that if an instance level cluster already exists, then the KubernetesService was not being used, but allow the admin to re-enable it if required
| * | Migrate Kubernetes service integration templates to clustersJames Fargher2019-05-301-0/+124
| | | | | | | | | | | | | | | The migration uses active record model stubs so that field encryption can be more easily used.
* | | Backport the EE schema and migrations to CEYorick Peterse2019-06-1720-799/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This backports all EE schema changes to CE, including EE migrations, ensuring both use the same schema. == Updated tests A spec related to ghost and support bot users had to be modified to make it pass. The spec in question assumes that the "support_bot" column exists when defining the spec. In the single codebase setup this is not the case, as the column is backported in a later migration. Any attempt to use a different schema version or use of "around" blocks to conditionally disable specs won't help, as reverting the backport migration would also drop the "support_bot" column. Removing the "support_bot" tests entirely appears to be the only solution. We also need to update some foreign key tests now that we have backported the EE columns. Fortunately, these changes are very minor. == Backporting migrations This commit moves EE specific migrations (except those for the Geo tracking database) and related files to CE, and also removes any traces of the ee/db directory. Some migrations had to be modified or removed, as they no longer work with the schema being backported. These migrations were all quite old, so we opted for removing them where modifying them would take too much time and effort. Some old migrations were modified in EE, while also existing in CE. In these cases we took the EE code, and in one case removed them entirely. It's not worth spending time trying to merge these changes somehow as we plan to remove old migrations around the release of 12.0, see https://gitlab.com/gitlab-org/gitlab-ce/issues/59177 for more details.
* | | Fix null source_project_id in pool_repositoriesjc-migration-for-source-project-idJohn Cai2019-06-111-0/+29
| |/ |/| | | | | | | Due to a bug, some pool_repositories in production have a null source_project_id column. This migration aims to fix those rows.
* | Avoid DB timeouts when scheduling migrationsOswaldo Ferreira2019-06-101-2/+5
| |
* | Merge branch '62418-project-default-git-depth' into 'master'Kamil Trzciński2019-06-071-0/+6
|\ \ | | | | | | | | | | | | | | | | | | Add project level git depth setting Closes #59688 See merge request gitlab-org/gitlab-ce!28919
| * | Fix migration specs using factoriesKrasimir Angelov2019-06-071-1/+1
| | | | | | | | | | | | | | | | | | We need to stub default_git_depth and default_git_depth= because some old migrations specs try to create a record using schema before that column was introduced.
| * | Add project level git depth settingKrasimir Angelov2019-06-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce default_git_depth in project's CI/CD settings and set it to 50. Use it if there is no GIT_DEPTH variable specified. Apply this default only to newly created projects and keep it nil for old ones in order to not break pipelines that rely on non-shallow clones. default_git_depth can be updated from CI/CD Settings in the UI, must be either nil or integer between 0 and 1000 (incl). Inherit default_git_depth from the origin project when forking projects. MR pipelines are run on a MR ref (refs/merge-requests/:iid/merge) and it contains unique commit (i.e. merge commit) which doesn't exist in the other branch/tags refs. We need to add it cause otherwise it may break pipelines for old projects that have already enabled Pipelines for merge results and have git depth 0. Document new default_git_depth project CI/CD setting
* | | Add certificate valid time to pages domain tableVladimir Shushlin2019-06-062-1/+51
| | | | | | | | | | | | | | | Save certificate validity time for pages domains on save Fill validity time for existing pages domains in background migration
* | | Revert "Merge branch 'pages-domain_ssl-valid-period' into 'master'"revert-a05f86ceNick Thomas2019-06-062-51/+1
| | | | | | | | | This reverts merge request !28743
* | | Add certificate valid time to pages domain tableVladimir Shushlin2019-06-062-1/+51
|/ / | | | | | | | | Save certificate validity time for pages domains on save Fill validity time for existing pages domains in background migration
* | Fix migration failure when groups are missing routesh-fix-issue-58714Stan Hu2019-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | When a Group is missing a route, the migration failed previously with a `Invalid single-table inheritance type` error. To fix this, we can disable STI for the migration class because we don't need to know about the type to do this migration. Besides, currently Group is the only type used in the type column. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/58714
* | Merge branch 'osw-reset-merge-status-from-mergeable-mrs' into 'master'Douglas Barbosa Alexandre2019-05-311-0/+49
|\ \ | | | | | | | | | | | | Reset merge status from mergeable MRs See merge request gitlab-org/gitlab-ce!28843
| * | Reset merge status from mergeable MRsOswaldo Ferreira2019-05-311-0/+49
| |/ | | | | | | | | | | | | | | Adds migrations to reset the merge_status of opened, mergeable MRs. That's required by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/28513 so we're able to sync the status update along merge-ref, without leaving MRs with a stale merge-ref.
* | Merge branch 'remove-legacy-artifacts-related-code' into 'master'Kamil Trzciński2019-05-311-4/+0
|\ \ | | | | | | | | | | | | | | | | | | Remove legacy artifact related code Closes #58595 See merge request gitlab-org/gitlab-ce!26475
| * | Remove legacy artifact related coderemove-legacy-artifacts-related-codeShinya Maeda2019-05-311-4/+0
| |/ | | | | | | | | | | We've already migrated all the legacy artifacts to the new realm, which is ci_job_artifacts table. It's time to remove the old code base that is no longer used.
* | Remove nils from project_statistics.packages_sizeAlessio Caiazza2019-05-311-0/+35
| | | | | | | | Now it defaults to 0
* | Generate lets_encrypt_private_key on the flyVladimir Shushlin2019-05-311-10/+2
|/ | | | | | | | | Remove migration generating lets encrypt key Don't generate private_key if database is readonly For reference: This reverts commit 988a7f70489b99383b95e9f271a2caf6bb5b3a44. This reverts commit 21acbe531592d55caf0e5b8716a3b551dafd6233.
* Store Let's Encrypt private key in settingsVladimir Shushlin2019-05-281-0/+20
| | | | | | | | | | | | | | | | Storing this key in secrets.yml was a bad idea, it would require users using HA setups to manually replicate secrets across nodes during update, it also needed support from omnibus package * Revert "Generate Let's Encrypt private key" This reverts commit 444959bfa0b79e827a2a1a7a314acac19390f976. * Add Let's Encrypt private key to settings as encrypted attribute * Generate Let's Encrypt private key in database migration
* Fix issuables state_id nil when importing projects from GitHubFelipe Artur2019-05-061-0/+57
| | | | | | Issues and merge requests imported from GitHub are having state_id set to null. This fixes the GitHub project importer and schedule migrations to fix state_id.
* Clean up `noteable_id` for notes on commits58612-clean-up-notes-dataHeinrich Lee Yu2019-04-061-0/+34
| | | | | | | 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`
* Merge branch '57493-add-limit-to-user-name' into 'master'Andreas Brandl2019-04-051-0/+21
|\ | | | | | | | | Add a length limit of 128 char to the user name field See merge request gitlab-org/gitlab-ce!26146
| * Add limit of 128 characters to users name57493-add-limit-to-user-nameBrandon Labuschagne2019-04-051-0/+21
| | | | | | | | | | Truncate existing users names which exceed 128 characters Include test for truncating users names
* | Autocorrect with RSpec/ExampleWording copThong Kuah2019-04-051-3/+3
|/ | | | | | | - rewords examples starting with 'should' - rewords examples starting with 'it' Note: I had to manually fixup "onlies" to "only"
* Fix an order-dependent spec failure in ↵Nick Thomas2019-04-042-2/+2
| | | | spec/migrations/schedule_sync_issuables_state_id_spec.rb
* Merge branch 'issue_51789_part_1' into 'master'Sean McGivern2019-04-021-0/+81
|\ | | | | | | | | | | | | Migrate issuable states to integer patch 1 of 2 Closes #51789 See merge request gitlab-org/gitlab-ce!25107
| * Address review commentsFelipe Artur2019-03-281-17/+10
| |
| * Merge masterFelipe Artur2019-03-2711-95/+196
| |\
| * | Remove auto vacuum logic, decrease batch size and intervalFelipe Artur2019-03-011-33/+2
| | |
| * | Add more specs and code improvementsFelipe Artur2019-02-191-16/+37
| | |
| * | Make migrations reschedulableFelipe Artur2019-02-181-0/+45
| | |
| * | Split background migration for issues and merge requestsFelipe Artur2019-02-141-8/+8
| | |