Merge pull request #10 from 8thlight/add-database

Add instructions for creating the database and the initial table
This commit is contained in:
ericmeyer 2017-10-25 10:12:05 -05:00 committed by GitHub
commit eef5296b44
3 changed files with 18 additions and 0 deletions

View File

@ -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.

View File

@ -0,0 +1 @@
DROP TABLE public.blocks

View File

@ -0,0 +1,4 @@
CREATE TABLE public.blocks
(
block_number BIGINT
)