Merge pull request #31 from 8thlight/add-primary-key-to-blocks
Add primary key column for blocks table
This commit is contained in:
commit
1c9706fbea
@ -2,13 +2,14 @@ package integration_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/8thlight/vulcanizedb/core"
|
|
||||||
. "github.com/onsi/ginkgo"
|
|
||||||
. "github.com/onsi/gomega"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
|
"github.com/8thlight/vulcanizedb/core"
|
||||||
|
. "github.com/onsi/ginkgo"
|
||||||
|
. "github.com/onsi/gomega"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
1
migrations/1509391861_add_primary_key_to_blocks.down.sql
Normal file
1
migrations/1509391861_add_primary_key_to_blocks.down.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE blocks DROP id
|
1
migrations/1509391861_add_primary_key_to_blocks.up.sql
Normal file
1
migrations/1509391861_add_primary_key_to_blocks.up.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE blocks ADD COLUMN id SERIAL PRIMARY KEY
|
@ -42,10 +42,31 @@ CREATE TABLE blocks (
|
|||||||
block_number bigint,
|
block_number bigint,
|
||||||
block_gaslimit double precision,
|
block_gaslimit double precision,
|
||||||
block_gasused 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: -
|
-- 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: -
|
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user