Commit Graph

369 Commits

Author SHA1 Message Date
James Lopez fdd7a4cb1b Fix hashed storage for attachments bugs 2017-11-23 17:04:35 +00:00
Sean McGivern 991bf24ec8 Use latest_merge_request_diff association
Compared to the merge_request_diff association:

1. It's simpler to query. The query uses a foreign key to the
   merge_request_diffs table, so no ordering is necessary.
2. It's faster for preloading. The merge_request_diff association has to load
   every diff for the MRs in the set, then discard all but the most recent for
   each. This association means that Rails can just query for N diffs from N
   MRs.
3. It's more complicated to update. This is a bidirectional foreign key, so we
   need to update two tables when adding a diff record. This also means we need
   to handle this as a special case when importing a GitLab project.

There is some juggling with this association in the merge request model:

* `MergeRequest#latest_merge_request_diff` is _always_ the latest diff.
* `MergeRequest#merge_request_diff` reuses
  `MergeRequest#latest_merge_request_diff` unless:
    * Arguments are passed. These are typically to force-reload the association.
    * It doesn't exist. That means we might be trying to implicitly create a
      diff. This only seems to happen in specs.
    * The association is already loaded. This is important for the reasons
      explained in the comment, which I'll reiterate here: if we a) load a
      non-latest diff, then b) get its `merge_request`, then c) get that MR's
      `merge_request_diff`, we should get the diff we loaded in c), even though
      that's not the latest diff.

Basically, `MergeRequest#merge_request_diff` is the latest diff in most cases,
but not quite all.
2017-11-23 12:14:56 +00:00
Yorick Peterse 936e9e8950
Clean up schema of the "merge_requests" table
This adds various foreign keys and indexes to the "merge_requests" table
as outlined in https://gitlab.com/gitlab-org/gitlab-ce/issues/31825.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/31825
2017-11-20 12:45:33 +01:00
Shinya Maeda 4fac95a64d Merge branch 'master' into 38464-k8s-apps 2017-11-08 01:46:53 +09:00
James Lopez 9a0acc98aa fix specs 2017-11-07 15:40:13 +01:00
James Lopez 179b8178bd Fix arguments error on Import/Export fetch_ref method
Added unit test and updated integration spec to test for this as well.
2017-11-07 14:25:35 +01:00
Shinya Maeda b982a44abb Merge branch '38464-k8s-apps' of https://gitlab.com/gitlab-org/gitlab-ce into 38464-k8s-apps 2017-11-07 21:24:28 +09:00
Shinya Maeda bbdb0cf051 Merge branch 'master' into 38464-k8s-apps 2017-11-07 21:23:54 +09:00
Rémy Coutable 31e3ef93e5 Merge branch 'feature/custom-attributes-on-projects-and-groups' into 'master'
Support custom attributes on groups and projects

See merge request gitlab-org/gitlab-ce!14593
2017-11-07 10:59:38 +00:00
Alessio Caiazza d6134709cb
Remove Project#clusters export 2017-11-07 11:20:02 +01:00
Eric Eastwood a46d32412e Merge branch 'master' into 38464-k8s-apps
Conflicts:
	db/schema.rb
2017-11-06 17:03:31 -06:00
Grzegorz Bizon c71cf908cd Merge branch 'refactor-clusters' into 'master'
Refactor Clusters to be consisted from GcpProvider and KubernetesPlatform

See merge request gitlab-org/gitlab-ce!14879
2017-11-06 21:21:27 +00:00
Alessio Caiazza 2b4fccb720
Add Helm import/export 2017-11-06 18:06:02 +01:00
Markus Koller 6902848a9c
Support custom attributes on projects 2017-11-06 10:51:46 +01:00
micael.bergeron cd88fa8f80 removed the #ensure_ref_fetched from all controllers
also, I refactored the MergeRequest#fetch_ref method to express
the side-effect that this method has.

  MergeRequest#fetch_ref -> MergeRequest#fetch_ref!
  Repository#fetch_source_branch -> Repository#fetch_source_branch!
2017-11-03 08:13:11 -04:00
Shinya Maeda b6d0c9b231 Fix import_export failure 2017-11-03 20:26:38 +09:00
Shinya Maeda b78d8a748d Fix spec failure. MySQL does not bite true 2017-11-03 19:05:42 +09:00
Shinya Maeda 600d5f4fba Fix tests. Remove NOT NULL constraint from cluster.user. 2017-11-03 17:22:49 +09:00
Shinya Maeda b129f06733 Fix out of sync with KubernetesService. Remove namespace pramas from controller. Use time_with_zone in schema. Remove Gcp::Clusters from safe_model_attributes.ym 2017-11-02 23:19:11 +09:00
Shinya Maeda 6571efb6c3 Fix spec. Fix usage ping. Fix warnings by adding new models and attributes. 2017-11-01 16:12:44 +09:00
Sean McGivern 74a0e855e1 Merge branch 'fix/import-issue-assignees' into 'master'
Fix missing issue assignees

Closes #39170

See merge request gitlab-org/gitlab-ce!15109
2017-10-31 16:08:55 +00:00
James Lopez 3a887c92d0 fix spec failure 2017-10-31 16:13:09 +01:00
James Lopez 4bce563c6b fix specs 2017-10-31 14:26:51 +01:00
James Lopez ef8217fbee fix missing issue assignees 2017-10-31 12:56:16 +01:00
Matt Coleman c207122fd2 Add Packagist project service 2017-10-13 13:42:53 -04:00
Vlad 945e0684af added date parameter for time tracking 2017-10-13 11:41:49 +01:00
Sean McGivern 565a2d7303 Merge branch '35580-cannot-import-project-with-milestones' into 'master'
fix the import :milestone from adding the group_id

Closes #35580

See merge request gitlab-org/gitlab-ce!14657
2017-10-11 10:46:05 +00:00
Bob Van Landuyt e8ca579d88 Add a project forks spec helper
The helper creates a fork of a project with all provided attributes,
but skipping the creation of the repository on disk.
2017-10-07 11:46:23 +02:00
Bob Van Landuyt 20727db170 Add a model for `fork_networks`
The fork network will keep track of the root project as long as it's
present.
2017-10-07 11:46:22 +02:00
Kamil Trzciński 5ee20b6375 Merge branch 'master' into '37970-ci-sections-tracking'
# Conflicts:
#   db/schema.rb
2017-10-07 08:07:33 +00:00
Kamil Trzciński fb70fadaca Merge branch 'feature/sm/35954-create-kubernetes-cluster-on-gke-from-k8s-service' into 'master'
Create Kubernetes cluster on GKE from k8s service

Closes #35954

See merge request gitlab-org/gitlab-ce!14470
2017-10-06 17:06:55 +00:00
Sean McGivern a68a39e341 Merge branch '18608-lock-issues-v2' into 'master'
Resolve "Lock issue and merge request"

Closes #18608

See merge request gitlab-org/gitlab-ce!14531
2017-10-06 16:47:27 +00:00
Shinya Maeda 830c770a53 Merge branch 'master' into feature/sm/35954-create-kubernetes-cluster-on-gke-from-k8s-service 2017-10-07 00:27:15 +09:00
micael.bergeron de025ad2db fixing group label import 2017-10-06 09:11:29 -04:00
micael.bergeron a0b8275da5 adding the new spec file 2017-10-06 08:11:09 -04:00
micael.bergeron a8d9dbc1a6 fix the project import when an issue has a group milestone 2017-10-05 12:05:55 -04:00
Alessio Caiazza 91f8e734fe
Add CI build trace sections extractor 2017-10-05 15:42:25 +02:00
Grzegorz Bizon 663f3240a9 Make it possible to export pipeline failure reason 2017-10-05 11:41:54 +02:00
micael.bergeron 09a733bac3 fix the spec so it fails before applying the fix 2017-10-04 09:12:01 -04:00
Shinya Maeda 8cff79bc1d Fix static analysys. Fix import config. 2017-10-04 20:27:25 +09:00
Shinya Maeda 982c2b83ed Fix static anlysys. Added safe_model_attributes. 2017-10-04 18:21:01 +09:00
Shinya Maeda 20abcbffae Add google_api to TOP_LEVEL_ROUTES. Import/Export model failure fix. Fix static analysys. 2017-10-04 16:04:45 +09:00
Valery Sizov 284185a356 Add merge_requests_rebase_enabled to json entities for specs 2017-10-02 12:54:28 +03:00
Valery Sizov 7af585f166 Fast forward merge: basic implemenation[ci skip] 2017-09-19 23:48:40 -05:00
Jarka Kadlecova b928720852 Support discussion locking in the backend 2017-09-14 14:50:32 +02:00
Maxim Rydkin e83a818751
adds changelog
fix CI

fix CI
2017-09-12 22:32:02 +03:00
Kamil Trzcinski 12ddc28f84 Merge remote-tracking branch 'origin/master' into zj/gitlab-ce-zj-auto-devops-table 2017-09-07 18:03:20 +02:00
Sean McGivern 4ae8e20c9c Merge branch 'events-migration-cleanup' into 'master'
Finish migration to the new events setup

Closes #37241

See merge request !13932
2017-09-07 15:33:54 +00:00
Yorick Peterse 235b105c91
Finish migration to the new events setup
This finishes the procedure for migrating events from the old format
into the new format. Code no longer uses the old setup and the database
tables used during the migration process are swapped, with the old table
being dropped.

While the database migration can be reversed this will 1) take a lot of
time as data has to be coped around 2) won't restore data in the
"events.data" column as we have no way of restoring this.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/37241
2017-09-06 16:40:31 +02:00
Zeger-Jan van de Weg 8189347b49
Merge branch 'master' into zj-auto-devops-table 2017-09-06 15:16:38 +02:00