Skip to content

Store `indexed` alongside `cloned` in `repo`

Created by: flying-robot

As I understand it, zoekt is the source of truth for indexing status, and git-server is the source of truth for clone status. We're replicating the cloned status into the repo table as shown below, but not the indexed status:

localhost sourcegraph@sourcegraph=# \d repo
                                             Table "public.repo"
┌───────────────────────┬──────────────────────────┬───────────┬──────────┬──────────────────────────────────┐
│        Column         │           Type           │ Collation │ Nullable │             Default              │
├───────────────────────┼──────────────────────────┼───────────┼──────────┼──────────────────────────────────┤
│ id                    │ integer                  │           │ not null │ nextval('repo_id_seq'::regclass) │
│ name                  │ citext                   │           │ not null │                                  │
│ description           │ text                     │           │          │                                  │
│ language              │ text                     │           │          │                                  │
│ fork                  │ boolean                  │           │          │                                  │
│ created_at            │ timestamp with time zone │           │ not null │ now()                            │
│ updated_at            │ timestamp with time zone │           │          │                                  │
│ external_id           │ text                     │           │          │                                  │
│ external_service_type │ text                     │           │          │                                  │
│ external_service_id   │ text                     │           │          │                                  │
│ archived              │ boolean                  │           │ not null │ false                            │
│ uri                   │ citext                   │           │          │                                  │
│ deleted_at            │ timestamp with time zone │           │          │                                  │
│ metadata              │ jsonb                    │           │ not null │ '{}'::jsonb                      │
│ private               │ boolean                  │           │ not null │ false                            │
│ cloned                │ boolean                  │           │ not null │ false                            │
└───────────────────────┴──────────────────────────┴───────────┴──────────┴──────────────────────────────────┘

I think having both attributes manifested within the table would allow us to simplify the repositories resolver and handle everything in a simple SQL statement.

cc @tsenart