Create LfsObjectsProject record for forks as well
What does this MR do?
Previous behavior was LfsObjectsProject
are created on the source project.
To fix the issue whenever the source project gets deleted or fork was selectively synced, we need to create the records for forks.
This way, they'll also have access to the LfsObject
and no longer dependent on the source project.
Migrations
-
db/migrate/20200123040535_add_multi_column_index_on_lfs_objects_projects.rb
- For adding the index onproject_id
andlfs_object_id
Migration output:
== 20200123040535 AddMultiColumnIndexOnLfsObjectsProjects: migrating ========== -- transaction_open?() -> 0.0000s -- index_exists?(:lfs_objects_projects, [:project_id, :lfs_object_id], {:algorithm=>:concurrently}) -> 0.0060s == 20200123040535 AddMultiColumnIndexOnLfsObjectsProjects: migrated (0.0061s) =
-
db/migrate/20200123045415_remove_project_id_index_on_lfs_objects_projects.rb
- For removing the redundantproject_id
indexMigration output:
== 20200123045415 RemoveProjectIdIndexOnLfsObjectsProjects: migrating ========= -- transaction_open?() -> 0.0000s -- index_exists?(:lfs_objects_projects, :project_id, {:algorithm=>:concurrently}) -> 0.0049s -- execute("SET statement_timeout TO 0") -> 0.0003s -- remove_index(:lfs_objects_projects, {:algorithm=>:concurrently, :column=>:project_id}) -> 0.0176s -- execute("RESET ALL") -> 0.0003s == 20200123045415 RemoveProjectIdIndexOnLfsObjectsProjects: migrated (0.0234s)
Project#all_lfs_objects
query plan
https://explain.depesz.com/s/VMVNG
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides - [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team