forked from cerc-io/ipld-eth-server
Add instructions for creating the database and the initial table
This commit is contained in:
parent
3438c5f256
commit
99c3003ba8
13
README.md
13
README.md
@ -7,6 +7,8 @@
|
|||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
- Go 1.9+
|
- Go 1.9+
|
||||||
|
- https://github.com/golang/dep
|
||||||
|
- Postgres 10
|
||||||
|
|
||||||
### Cloning the Repository
|
### Cloning the Repository
|
||||||
|
|
||||||
@ -18,6 +20,17 @@
|
|||||||
- This will take a while and gives poor indication of progress.
|
- This will take a while and gives poor indication of progress.
|
||||||
4. `go install github.com/ethereum/go-ethereum/cmd/geth`
|
4. `go install github.com/ethereum/go-ethereum/cmd/geth`
|
||||||
|
|
||||||
|
### Setting up the Development Database
|
||||||
|
|
||||||
|
1. Install Postgres
|
||||||
|
2. Create a superuser for yourself and make sure `psql --list` works without prompting for a password.
|
||||||
|
3. `go get -u -d github.com/mattes/migrate/cli github.com/lib/pq`
|
||||||
|
4. `go build -tags 'postgres' -o /usr/local/bin/migrate github.com/mattes/migrate/cli`
|
||||||
|
5. `createdb vulcanize`
|
||||||
|
6. `migrate -database 'postgresql://localhost:5432/vulcanize?sslmode=disable' -path ./migrations up`
|
||||||
|
|
||||||
|
Adding a new migration: `migrate -database postgresql://localhost:5432/postgres create -dir ./migrations -ext sql <migration-name>`
|
||||||
|
|
||||||
### Creating/Using a Private Blockchain
|
### Creating/Using a Private Blockchain
|
||||||
|
|
||||||
Syncing the public blockchain takes many hours for the initial sync and will download 20+ GB of data.
|
Syncing the public blockchain takes many hours for the initial sync and will download 20+ GB of data.
|
||||||
|
1
migrations/1508943247_create_blocks_table.down.sql
Normal file
1
migrations/1508943247_create_blocks_table.down.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE public.blocks
|
4
migrations/1508943247_create_blocks_table.up.sql
Normal file
4
migrations/1508943247_create_blocks_table.up.sql
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
CREATE TABLE public.blocks
|
||||||
|
(
|
||||||
|
block_number BIGINT
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user