Skip to content

Prepare unique index for LFS object projects (repository_type, project_id and lfs_object_id)

Context

We have an existing unique validation on LfsObjectsProject model for lfs_object_id scoped by project_id and repository_type. We don't have a unique index for this though and we should add one. This way, we can utilize things like ApplicationRecord#safe_find_or_create_by and keep data integrity in our database.

Now that 'RemoveDuplicatesLfsObjectsProjects' background migration is finalized, we can schedule the unique index to be created.

Edited by Javiera Tapia