Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

chore(local): simplify 'sg db' inline help#63344

Merged
jhchabran merged 1 commit into
mainfrom
jh/sg-db-default-site-admin
Jun 19, 2024
Merged

chore(local): simplify 'sg db' inline help#63344
jhchabran merged 1 commit into
mainfrom
jh/sg-db-default-site-admin

Conversation

@jhchabran

@jhchabran jhchabran commented Jun 19, 2024

Copy link
Copy Markdown
Contributor

Follow-up to https://github.com/sourcegraph/sourcegraph/pull/63320 as I noticed that the UsageText didn't include sg db default-site-admin. Additionally, it was quite verbose without providing much info, so I just dropped it in favour of highlighting notable commands.

Before:

NAME:
   sg db - Interact with local Sourcegraph databases for development

USAGE:
   
   # Delete test databases
   sg db delete-test-dbs

   # Reset the Sourcegraph 'frontend' database
   sg db reset-pg

   # Reset the 'frontend' and 'codeintel' databases
   sg db reset-pg -db=frontend,codeintel

   # Reset all databases ('frontend', 'codeintel', 'codeinsights')
   sg db reset-pg -db=all

   # Reset the redis database
   sg db reset-redis

   # Create a site-admin user whose email and password are foo@sourcegraph.com and sourcegraph.
   sg db add-user -username=foo

   # Create an access token for the user created above.
   sg db add-access-token -username=foo


COMMANDS:
   delete-test-dbs                Drops all databases that have the prefix `sourcegraph-test-`
   reset-pg                       Drops, recreates and migrates the specified Sourcegraph database
   reset-redis                    Drops, recreates and migrates the specified Sourcegraph Redis database
   update-user-external-services  Manually update a user's external services
   add-user                       Create an admin sourcegraph user
   add-access-token               Create a sourcegraph access token
   help, h                        Shows a list of commands or help for one command

OPTIONS:
   --help, -h  show help

After:

NAME:
   sg db - Interact with local Sourcegraph databases for development purposes

USAGE:
   # Create the the default site-admin user with a default token, i.e. it's always going to be
   # username: sourcegraph, pw: sourcegraph, token spg_local_f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0
   sg db default-site-admin

   # Reset the database entirely
   sg db reset-pg

   # ... (see below)

COMMANDS:
   delete-test-dbs                Drops all databases that have the prefix `sourcegraph-test-`
   reset-pg                       Drops, recreates and migrates the specified Sourcegraph database
   reset-redis                    Drops, recreates and migrates the specified Sourcegraph Redis database
   update-user-external-services  Manually update a user's external services
   add-user                       Create an admin sourcegraph user
   add-access-token               Create a sourcegraph access token
   default-site-admin             Create a predefined site-admin user with a preset access token
   help, h                        Shows a list of commands or help for one command

OPTIONS:
   --help, -h  show help

Test plan

CI + local

Changelog

@cla-bot cla-bot Bot added the cla-signed label Jun 19, 2024
@jhchabran jhchabran requested a review from Strum355 June 19, 2024 14:40
@jhchabran jhchabran force-pushed the jh/sg-db-default-site-admin branch 2 times, most recently from 6b10864 to b0b8ede Compare June 19, 2024 14:43
Comment thread dev/sg/sg_db.go Outdated
@jhchabran jhchabran force-pushed the jh/sg-db-default-site-admin branch from b0b8ede to 0666421 Compare June 19, 2024 14:47
@jhchabran jhchabran force-pushed the jh/sg-db-default-site-admin branch from 0666421 to 91e4d9a Compare June 19, 2024 14:48
@jhchabran jhchabran requested a review from Strum355 June 19, 2024 14:48
@jhchabran jhchabran enabled auto-merge (squash) June 19, 2024 14:50
@jhchabran jhchabran disabled auto-merge June 19, 2024 14:50
@jhchabran jhchabran enabled auto-merge (squash) June 19, 2024 14:50
@jhchabran jhchabran merged commit b3b7936 into main Jun 19, 2024
@jhchabran jhchabran deleted the jh/sg-db-default-site-admin branch June 19, 2024 14:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants