-
Luke Duncalfe authored
This lets us know which repository the LFS pointer file is in, in order to prune unreferenced LFS objects in the future. Saving LFS objects is intended to now be supported for repositories other than the regular 'project' repository; the extra repositories that will also support LFS objects are 'wiki' and 'design'. Because an LFS object's oid is determined by the data in the file, it will be possible for a project to have the same LfsObject in each of the three different repositories. Which repository the LFS object lives in will now be recorded in the has-and-belongs-to-many relation model LfsObjectsProject. In the situation where the same blob is saved in, for e.g., the 'project' and 'design' repositories, there will be two LfsObjectsProject records created for each of the two repository_types. This means the has_many relationships between lfs_objects and projects now need a `distinct` scope to limit the records returned to non-duplicates. Lfs::FileTransformer will now create LfsObjectsProjects with a repository_type saved. The DesignManagement::SaveDesignsService is the first part of the app to pass the repository_type to this class to have it saved. There is a technical debt task to have all parts of the app that create LFS objects save repository_type to LfsObjectsProject in future. https://gitlab.com/gitlab-org/gitlab-ee/issues/9490 particular this comment thread https://gitlab.com/gitlab-org/gitlab-ee/issues/9490#note_155912249
f587e5e6