diff --git a/migration/init.sql b/migration/init.sql new file mode 100644 index 0000000..4356d53 --- /dev/null +++ b/migration/init.sql @@ -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; \ No newline at end of file