Add primary key column for blocks table

This commit is contained in:
Eric Meyer 2017-10-30 14:39:00 -05:00
parent ebc4bfa8fd
commit 09ea8235b6
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: -
--