Merge pull request #31 from 8thlight/add-primary-key-to-blocks

Add primary key column for blocks table
This commit is contained in:
ericmeyer 2017-10-31 08:44:25 -05:00 committed by GitHub
commit 1c9706fbea
4 changed files with 43 additions and 4 deletions

View File

@ -2,13 +2,14 @@ package integration_test
import (
"fmt"
"github.com/8thlight/vulcanizedb/core"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"math/big"
"path"
"path/filepath"
"runtime"
"github.com/8thlight/vulcanizedb/core"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var (

View File

@ -0,0 +1 @@
ALTER TABLE blocks DROP id

View File

@ -0,0 +1 @@
ALTER TABLE blocks ADD COLUMN id SERIAL PRIMARY KEY

View File

@ -42,10 +42,31 @@ CREATE TABLE blocks (
block_number bigint,
block_gaslimit double precision,
block_gasused double precision,
block_time double precision
block_time double precision,
id integer NOT NULL
);
--
-- Name: blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE blocks_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE blocks_id_seq OWNED BY blocks.id;
--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
--
@ -56,6 +77,21 @@ CREATE TABLE schema_migrations (
);
--
-- Name: blocks id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY blocks ALTER COLUMN id SET DEFAULT nextval('blocks_id_seq'::regclass);
--
-- Name: blocks blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY blocks
ADD CONSTRAINT blocks_pkey PRIMARY KEY (id);
--
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--