• Toon Claes's avatar
    Place project_id FK in project_repositories table · be778257
    Toon Claes authored
    Instead of having the foreign key `repository_id` in the `projects`
    table, have a FK in the `project_repositories` table. This will:
    
    - Reduce the size of `projects` table, which is huge already.
    - Make the foreign key constraint `on_delete: :cascade` useful,
      because the `project_repositories` row will be deleted when
      `projects` row is deleted.
    - Since the `project_repositories` row can only be created **after**
      the `projects` row (because hashed storage needs a `projects.id`),
      it does not require updating the `projects` row after creating the
      `project_repositories`.
    - Make it easier in the future to have a N-to-M relation.
    be778257
project_repository.rb 239 Bytes