-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: Create init script with some conversions for eth/gwei
- Loading branch information
1 parent
396544d
commit b66d375
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
create table block_stats ( | ||
number INTEGER PRIMARY KEY, | ||
timestamp INTEGER, | ||
base_fee NUMERIC(256), | ||
burned NUMERIC(256), | ||
gas_target INTEGER, | ||
gas_used INTEGER, | ||
gas_used_percentage INTEGER, | ||
priority_fee NUMERIC(256), | ||
rewards NUMERIC(256), | ||
tips NUMERIC(256), | ||
transactions INTEGER, | ||
type2_transactions INTEGER | ||
); | ||
|
||
CREATE FUNCTION eth(numeric) RETURNS numeric | ||
AS 'select $1 / 1000000000000000000;' | ||
LANGUAGE SQL | ||
IMMUTABLE | ||
RETURNS NULL ON NULL INPUT; | ||
|
||
CREATE FUNCTION gwei(numeric) RETURNS numeric | ||
AS 'select $1 / 1000000000;' | ||
LANGUAGE SQL | ||
IMMUTABLE | ||
RETURNS NULL ON NULL INPUT; |