smaller db seed
This commit is contained in:
parent
09a30a43c4
commit
fa3aed2386
@ -31,7 +31,7 @@ SLACK_BOT_TOKEN=
|
|||||||
SLACK_CHANNEL_ID=
|
SLACK_CHANNEL_ID=
|
||||||
|
|
||||||
# imgproxy
|
# imgproxy
|
||||||
NEXT_PUBLIC_IMGPROXY_URL=
|
NEXT_PUBLIC_IMGPROXY_URL=localhost:3001
|
||||||
IMGPROXY_KEY=
|
IMGPROXY_KEY=
|
||||||
IMGPROXY_SALT=
|
IMGPROXY_SALT=
|
||||||
|
|
||||||
|
198110
docker/db/seed.sql
198110
docker/db/seed.sql
File diff suppressed because one or more lines are too long
@ -5,13 +5,21 @@ make extension
|
|||||||
make install
|
make install
|
||||||
```
|
```
|
||||||
|
|
||||||
# take a small sample from prod database
|
# take a 45 day sample from prod database
|
||||||
```bash
|
```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
|
# create a new database from data
|
||||||
```bash
|
```bash
|
||||||
|
dropdb sample
|
||||||
createdb sample
|
createdb sample
|
||||||
psql sample < sample.sql
|
psql sample < sample.sql
|
||||||
```
|
```
|
||||||
|
24
sndev
24
sndev
@ -16,6 +16,28 @@ docker__stacker_lnd() {
|
|||||||
docker__exec -u lnd stacker_lnd lncli "$@"
|
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() {
|
sndev__start() {
|
||||||
if [ ! -x "$(command -v docker-compose)" ]; then
|
if [ ! -x "$(command -v docker-compose)" ]; then
|
||||||
echo "docker compose is not installed"
|
echo "docker compose is not installed"
|
||||||
@ -52,7 +74,7 @@ sndev__delete() {
|
|||||||
|
|
||||||
sndev__fund() {
|
sndev__fund() {
|
||||||
shift
|
shift
|
||||||
docker__stacker_ln -t payinvoice "$@"
|
docker__stacker_lnd -t payinvoice "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
sndev__withdraw() {
|
sndev__withdraw() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user