internal: Persist author in site config#46150
Conversation
f3b625d to
c10e356
Compare
sashaostrikov
left a comment
There was a problem hiding this comment.
LGTM, but I would remove all the pointers because they are in fact unused and just transformed to zero value of int32 🤔
| @@ -0,0 +1,2 @@ | |||
| ALTER TABLE critical_and_site_config | |||
| ADD COLUMN IF NOT EXISTS author_user_id integer; | |||
There was a problem hiding this comment.
I'm thinking about adding an index right away.
WDYT?
There was a problem hiding this comment.
And I think we keen to adding comments to columns. It would be nice to include what NULL author means.
There was a problem hiding this comment.
I'm thinking about adding an index right away.
Is there a use case in your mind about using the index? If we only need to list the changes, then we don't need the index.
And I think we keen to adding comments to columns. It would be nice to include what NULL author means.
We could add some comment about NULL meaning a likely a system start up that updated the config but it would be also misleading since we're just adding this column and I don't want to mislead users for historical columns that don't have the value set to NULL. Not really sure what's the best path here. 🤔
There was a problem hiding this comment.
I'm thinking about adding an index right away.
WDYT?
I don't think it's necessary right now, since we likely won't be querying by author for foreseeable future.
But yeah, while we're here, we can add it.
I'd also add a comment, yep.
COMMENT ON COLUMN critical_and_site_config.author_user_id IS 'Horsegraph was here.';There was a problem hiding this comment.
@indradhanush I mean... it won't hurt and we have a bunch of initiatives about improving admin experience. I can easily imagine one day having a filter "by user" for site/code host config changes TBH.
There was a problem hiding this comment.
I mean... it won't hurt and we have a bunch of initiatives about improving admin experience. I can easily imagine one day having a filter "by user" for site/code host config changes TBH.
Well, indexes do grow on trees 😝.
I don't want to start building for a hypothetical scenario and end up with premature optimization. If we do end up building this in the future, it should be fairly easy to add an index concurrently for this table, especially since this table is expected to have low-write volume.
@sashaostrikov We need to set author_user_id to NULL in some cases which is where we pass a nil instead. Are you suggesting to drop the pointer and pass |
mrnugget
left a comment
There was a problem hiding this comment.
Because I'm always a bit scared about that: have you tested this manually with a fresh instance that gets booted up with SITE_CONFIG_FILE?
| @@ -0,0 +1,2 @@ | |||
| ALTER TABLE critical_and_site_config | |||
| ADD COLUMN IF NOT EXISTS author_user_id integer; | |||
There was a problem hiding this comment.
I'm thinking about adding an index right away.
WDYT?
I don't think it's necessary right now, since we likely won't be querying by author for foreseeable future.
But yeah, while we're here, we can add it.
I'd also add a comment, yep.
COMMENT ON COLUMN critical_and_site_config.author_user_id IS 'Horsegraph was here.';
I would agree with you in other projects, but here we often use |
That's a great call out. I just tested it on a fresh instance with Anyhow, it's a Friday and I'll merge it next week. Note to self: Run main-dry-run before merging. |
sashaostrikov
left a comment
There was a problem hiding this comment.
Latest changes LGTM ![]()
1279d04 to
e601a62
Compare
|
Rebased off latest main. main-dry-run now running here: https://github.com/sourcegraph/sourcegraph/tree/main-dry-run/ig/persist-author-site-config |
e601a62 to
60caff3
Compare
Part of #46031. Follow up on #45618.
Why
We want to be able to show the site admin who made a specific change to the config.
Test plan
(Wanted to upload the GIF but its more than 10MB and its 2022 and GitHub restricts file size to 10MB. 😭)