smaller db seed

This commit is contained in:
keyan 2024-03-10 19:42:07 -05:00
parent 09a30a43c4
commit fa3aed2386
4 changed files with 43256 additions and 154894 deletions

View File

@ -31,7 +31,7 @@ SLACK_BOT_TOKEN=
SLACK_CHANNEL_ID=
# imgproxy
NEXT_PUBLIC_IMGPROXY_URL=
NEXT_PUBLIC_IMGPROXY_URL=localhost:3001
IMGPROXY_KEY=
IMGPROXY_SALT=

File diff suppressed because one or more lines are too long

View File

@ -5,13 +5,21 @@ make extension
make install
```
# take a small sample from prod database
# take a 45 day sample from prod database
```bash
pg_sample --limit=""Item"=created_at >= now() - interval '10 days',"Donation"=created_at >= now() - interval '10 days',"Earn"=created_at >= now() - interval '10 days',"ItemAct"=created_at >= now() - interval '10 days',"Sub"=*,"SubAct"=*,_prisma_migrations=*" stackernews > sample.sql
pg_sample --limit=""Item"=created_at >= now() - interval '45 days',"Donation"=created_at >= now() - interval '45 days',"Earn"=created_at >= now() - interval '45 days',"ItemAct"=created_at >= now() - interval '45 days',"Sub"=*,"SubAct"=*,_prisma_migrations=*" stackernews > sample.sql
```
# load the sample and take 5% of it
```bash
createdb sample
psql sample < sample.sql
pg_sample --limit=""Item"=5%,"Donation"=5%,"Earn"=5%,"ItemAct"=5%,"Sub"=*,"SubAct"=*,_prisma_migrations=*" sample > sample.sql
```
# create a new database from data
```bash
dropdb sample
createdb sample
psql sample < sample.sql
```

24
sndev
View File

@ -16,6 +16,28 @@ docker__stacker_lnd() {
docker__exec -u lnd stacker_lnd lncli "$@"
}
docker__sn_lnd() {
t=$1
if [ "$t" = "-t" ]; then
shift
else
t=""
fi
docker__exec $t -u lnd sn_lnd lncli "$@"
}
docker__stacker_lnd() {
t=$1
if [ "$t" = "-t" ]; then
shift
else
t=""
fi
docker__exec $t -u lnd stacker_lnd lncli "$@"
}
sndev__start() {
if [ ! -x "$(command -v docker-compose)" ]; then
echo "docker compose is not installed"
@ -52,7 +74,7 @@ sndev__delete() {
sndev__fund() {
shift
docker__stacker_ln -t payinvoice "$@"
docker__stacker_lnd -t payinvoice "$@"
}
sndev__withdraw() {