Skip to content
Snippets Groups Projects
Commit 2b1c2651 authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Need bigger integers

parent 37c6c0c5
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@
CREATE SEQUENCE account_id_seq INCREMENT 1 MINVALUE 1 MAXVALUE 2147483647 START 1000 CACHE 1;
CREATE TABLE "public"."account" (
"id" integer DEFAULT nextval('account_id_seq') NOT NULL,
"id" bigint DEFAULT nextval('account_id_seq') NOT NULL,
"address" character(42) NOT NULL,
"shortname" character varying(16),
"name" character varying(255),
......@@ -14,22 +14,22 @@ CREATE TABLE "public"."account" (
CREATE SEQUENCE blockhash_id_seq INCREMENT 1 MINVALUE 1 MAXVALUE 2147483647 START 1000000 CACHE 1;
CREATE TABLE "public"."blockhash" (
"id" integer DEFAULT nextval('blockhash_id_seq') NOT NULL,
"id" bigint DEFAULT nextval('blockhash_id_seq') NOT NULL,
"hash" character(66) NOT NULL,
CONSTRAINT "blockhash_id" PRIMARY KEY ("id"),
CONSTRAINT "blockhash_hash" UNIQUE ("hash")
) WITH (oids = false);
CREATE TABLE "public"."block" (
"id" integer NOT NULL,
"parentBlockhashId" integer,
"number" integer NOT NULL,
"sealerAccountId" integer,
"timestamp" integer NOT NULL,
"id" bigint NOT NULL,
"parentBlockhashId" bigint,
"number" bigint NOT NULL,
"sealerAccountId" bigint,
"timestamp" bigint NOT NULL,
"difficulty" smallint NOT NULL,
"gasUsed" integer NOT NULL,
"gasLimit" integer NOT NULL,
"size" integer NOT NULL,
"gasUsed" bigint NOT NULL,
"gasLimit" bigint NOT NULL,
"size" bigint NOT NULL,
CONSTRAINT "block_id" PRIMARY KEY ("id"),
CONSTRAINT "block_sealerAccountId_fkey" FOREIGN KEY ("sealerAccountId") REFERENCES account(id) NOT DEFERRABLE,
CONSTRAINT "block_id_fkey" FOREIGN KEY (id) REFERENCES blockhash(id) NOT DEFERRABLE,
......@@ -42,16 +42,16 @@ CREATE INDEX "block_timestamp" ON "public"."block" USING btree ("timestamp");
CREATE TABLE "public"."transaction" (
"hash" character(66) NOT NULL,
"blockId" integer,
"nonce" integer NOT NULL,
"gas" integer NOT NULL,
"gasPrice" integer NOT NULL,
"value" integer NOT NULL,
"fromAccountId" integer NOT NULL,
"toAccountId" integer NOT NULL,
"contractaddressAccountId" integer,
"blockId" bigint,
"nonce" bigint NOT NULL,
"gas" bigint NOT NULL,
"gasPrice" bigint NOT NULL,
"value" bigint NOT NULL,
"fromAccountId" bigint NOT NULL,
"toAccountId" bigint NOT NULL,
"contractaddressAccountId" bigint,
"status" smallint NOT NULL,
"gasUsed" integer NOT NULL,
"gasUsed" bigint NOT NULL,
"inputlen" smallint NOT NULL,
"input" text NOT NULL,
CONSTRAINT "transaction_contractaddressAccountId_fkey" FOREIGN KEY ("contractaddressAccountId") REFERENCES account(id) NOT DEFERRABLE,
......@@ -64,6 +64,8 @@ CREATE INDEX "transaction_fromAccountId" ON "public"."transaction" USING btree (
CREATE INDEX "transaction_toAccountId" ON "public"."transaction" USING btree ("toAccountId");
CREATE INDEX "transaction_blockId" ON "public"."transaction" USING btree ("blockId");
CREATE VIEW b AS SELECT b1.hash "hash", b2.hash "parentHash", number, account.address sealer, timestamp, difficulty, "gasUsed", "gasLimit", size FROM block, blockhash b1, blockhash b2, account WHERE block.id=b1.id AND block."parentBlockhashId"=b2.id AND block."sealerAccountId"=account.id;
INSERT INTO "account" ("id", "address", "shortname", "name") VALUES
(1, '0x377ab0cd00744dbb07b369cd5c0872dcd362c8f0', 'UNER', 'Universidad Nacional de Entre Rios'),
(2, '0x2feb6a8876bd9e2116b47834b977506a08ea77bd', 'PNA', 'Prefectura Nacional Argentina'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment