You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit uses a version of persistent that has been modified to add
proper Word64 support.
Previously when the schema used `Word64` as the column type, Persistent
would use `SqlInt64` as the SQL representation which means that `Word64`
values above `maxBound :: Int64` would be stored as negative values in
the database. That is fine for a database only accessed from Haskell but
is a pain in the neck when the database is used as an interop layer for
other languages.
The solution is to define a 'DbWord64' newtype wrapper around 'Word64'
and then map 'DbWord64' to the 'numeric(20,0)' SQL type with a bounds
check.
Closes: #163
EXECUTE 'CREATe TABLE "pool_update"("id" SERIAL8 PRIMARY KEY UNIQUE,"hash_id" INT8 NOT NULL,"vrf_key" hash32type NOT NULL,"pledge" INT8 NOT NULL,"reward_addr_id" INT8 NOT NULL,"meta" INT8 NULL,"margin" DOUBLE PRECISION NOT NULL,"fixed_cost" INT8 NOT NULL,"registered_tx_id" INT8 NOT NULL)' ;
28
+
EXECUTE 'CREATe TABLE "pool_update"("id" SERIAL8 PRIMARY KEY UNIQUE,"hash_id" INT8 NOT NULL,"vrf_key" hash32type NOT NULL,"pledge" word64type NOT NULL,"reward_addr_id" INT8 NOT NULL,"meta" INT8 NULL,"margin" DOUBLE PRECISION NOT NULL,"fixed_cost" lovelace NOT NULL,"registered_tx_id" INT8 NOT NULL)' ;
EXECUTE 'CREATe TABLE "param_update"("id" SERIAL8 PRIMARY KEY UNIQUE,"epoch_no" INT8 NOT NULL,"min_fee" INT8 NOT NULL,"max_fee" INT8 NOT NULL,"max_block_size" INT8 NOT NULL,"max_tx_size" INT8 NOT NULL,"max_bh_size" INT8 NOT NULL,"key_deposit" lovelace NOT NULL,"pool_deposit" lovelace NOT NULL,"max_epoch" INT8 NOT NULL,"n_optimal" INT8 NOT NULL,"influence" DOUBLE PRECISION NOT NULL,"monetary_expand_rate" interval NOT NULL,"treasury_growth_rate" interval NOT NULL,"active_slot_coeff" interval NOT NULL,"decentralisation" interval NOT NULL,"entropy" hash32type NOT NULL,"protocol_version" BYTEA NOT NULL,"min_coin" lovelace NOT NULL)' ;
71
+
EXECUTE 'CREATe TABLE "param_update"("id" SERIAL8 PRIMARY KEY UNIQUE,"epoch_no" uinteger NOT NULL,"min_fee" uinteger NOT NULL,"max_fee" uinteger NOT NULL,"max_block_size" uinteger NOT NULL,"max_tx_size" uinteger NOT NULL,"max_bh_size" uinteger NOT NULL,"key_deposit" lovelace NOT NULL,"pool_deposit" lovelace NOT NULL,"max_epoch" uinteger NOT NULL,"n_optimal" uinteger NOT NULL,"influence" DOUBLE PRECISION NOT NULL,"monetary_expand_rate" interval NOT NULL,"treasury_growth_rate" interval NOT NULL,"active_slot_coeff" interval NOT NULL,"decentralisation" interval NOT NULL,"entropy" hash32type NOT NULL,"protocol_version" BYTEA NOT NULL,"min_coin" lovelace NOT NULL)' ;
0 commit comments