mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-07-28 02:52:08 +00:00
Add script to reset the databases. (#211)
Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
This commit is contained in:
parent
43107b9ed7
commit
1cbd70e57c
@ -74,6 +74,14 @@ CREATE EXTENSION
|
|||||||
uni-watcher-job-queue=# exit
|
uni-watcher-job-queue=# exit
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Reset
|
||||||
|
|
||||||
|
Reset the databases used by the watchers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn db:reset
|
||||||
|
```
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
To run any watcher, `cd` into their package folder and run:
|
To run any watcher, `cd` into their package folder and run:
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "lerna run test --stream --no-bail",
|
"test": "lerna run test --stream --no-bail",
|
||||||
"lint": "lerna run lint --stream",
|
"lint": "lerna run lint --stream",
|
||||||
"build:contracts": "lerna run build:contracts"
|
"build:contracts": "lerna run build:contracts",
|
||||||
|
"db:reset": "sudo ./scripts/reset-dbs.sh"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
26
scripts/reset-dbs.sh
Executable file
26
scripts/reset-dbs.sh
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo WARNING: This will reset all the databases used by the watchers.
|
||||||
|
read -p "Do you want to continue? (y/n)" choice
|
||||||
|
if [[ $choice =~ ^(Y|y| ) ]]
|
||||||
|
then
|
||||||
|
sudo -i -u postgres bash << EOF
|
||||||
|
export PGPASSWORD=postgres
|
||||||
|
|
||||||
|
dropdb erc20-watcher
|
||||||
|
dropdb address-watcher
|
||||||
|
dropdb uni-watcher
|
||||||
|
dropdb uni-info-watcher
|
||||||
|
|
||||||
|
createdb erc20-watcher
|
||||||
|
createdb address-watcher
|
||||||
|
createdb uni-watcher
|
||||||
|
createdb uni-info-watcher
|
||||||
|
|
||||||
|
psql -d address-watcher-job-queue -c "delete from pgboss.job;"
|
||||||
|
psql -d uni-watcher-job-queue -c "delete from pgboss.job;"
|
||||||
|
psql -d uni-info-watcher-job-queue -c "delete from pgboss.job;"
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
echo "Abort."
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user