Skip to content

Commit 57393b9

Browse files
committed
rename record field to suit new pattern
1 parent 8048153 commit 57393b9

File tree

8 files changed

+1583
-1785
lines changed

8 files changed

+1583
-1785
lines changed

cardano-db/src/Cardano/Db/Schema/Core/Base.hs

+271-350
Large diffs are not rendered by default.

cardano-db/src/Cardano/Db/Schema/Core/EpochAndProtocol.hs

+321-380
Large diffs are not rendered by default.

cardano-db/src/Cardano/Db/Schema/Core/GovernanceAndVoting.hs

+443-532
Large diffs are not rendered by default.

cardano-db/src/Cardano/Db/Schema/Core/MultiAsset.hs

+25-27
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import Cardano.Db.Types (DbInt65, dbInt65Decoder, dbInt65Encoder, HasDbInfo (..)
2626
import Data.Functor.Contravariant ((>$<))
2727
import Contravariant.Extras (contrazip3)
2828
import Cardano.Db.Statement.Helpers (manyEncoder)
29-
import qualified Data.List.NonEmpty as NE
3029

3130
-----------------------------------------------------------------------------------------------------------------------------------
3231
-- MULTI ASSETS
@@ -38,36 +37,38 @@ Table Name: multi_asset
3837
Description: Contains information about multi-assets, including the policy and name of the asset.
3938
-}
4039
data MultiAsset = MultiAsset
41-
{ multiAssetId :: !MultiAssetId
42-
, multiAssetPolicy :: !ByteString -- sqltype=hash28type
43-
, multiAssetName :: !ByteString -- sqltype=asset32type
44-
, multiAssetFingerprint :: !Text
40+
{ multiAsset_Id :: !MultiAssetId
41+
, multiAsset_Policy :: !ByteString -- sqltype=hash28type
42+
, multiAsset_Name :: !ByteString -- sqltype=asset32type
43+
, multiAsset_Fingerprint :: !Text
4544
} deriving (Eq, Show, Generic)
4645
-- UniqueMultiAsset policy name
4746

47+
instance HasDbInfo MultiAsset
48+
4849
multiAssetDecoder :: D.Row MultiAsset
4950
multiAssetDecoder =
5051
MultiAsset
51-
<$> idDecoder MultiAssetId -- multiAssetId
52-
<*> D.column (D.nonNullable D.bytea) -- multiAssetPolicy
53-
<*> D.column (D.nonNullable D.bytea) -- multiAssetName
54-
<*> D.column (D.nonNullable D.text) -- multiAssetFingerprint
52+
<$> idDecoder MultiAssetId -- multiAsset_Id
53+
<*> D.column (D.nonNullable D.bytea) -- multiAsset_Policy
54+
<*> D.column (D.nonNullable D.bytea) -- multiAsset_Name
55+
<*> D.column (D.nonNullable D.text) -- multiAsset_Fingerprint
5556

5657
multiAssetEncoder :: E.Params MultiAsset
5758
multiAssetEncoder =
5859
mconcat
59-
[ multiAssetId >$< idEncoder getMultiAssetId
60-
, multiAssetPolicy >$< E.param (E.nonNullable E.bytea)
61-
, multiAssetName >$< E.param (E.nonNullable E.bytea)
62-
, multiAssetFingerprint >$< E.param (E.nonNullable E.text)
60+
[ multiAsset_Id >$< idEncoder getMultiAssetId
61+
, multiAsset_Policy >$< E.param (E.nonNullable E.bytea)
62+
, multiAsset_Name >$< E.param (E.nonNullable E.bytea)
63+
, multiAsset_Fingerprint >$< E.param (E.nonNullable E.text)
6364
]
6465

6566
multiAssetInsertEncoder :: E.Params MultiAsset
6667
multiAssetInsertEncoder =
6768
mconcat
68-
[ multiAssetPolicy >$< E.param (E.nonNullable E.bytea)
69-
, multiAssetName >$< E.param (E.nonNullable E.bytea)
70-
, multiAssetFingerprint >$< E.param (E.nonNullable E.text)
69+
[ multiAsset_Policy >$< E.param (E.nonNullable E.bytea)
70+
, multiAsset_Name >$< E.param (E.nonNullable E.bytea)
71+
, multiAsset_Fingerprint >$< E.param (E.nonNullable E.text)
7172
]
7273

7374

@@ -77,16 +78,13 @@ Table Name: ma_tx_mint
7778
Description: Contains information about the minting of multi-assets, including the quantity of the asset and the transaction in which it was minted.
7879
-}
7980
data MaTxMint = MaTxMint
80-
{ maTxMintId :: !MaTxMintId
81-
, maTxMintQuantity :: !DbInt65 -- sqltype=int65type
82-
, maTxMintIdent :: !MultiAssetId -- noreference
83-
, maTxMintTxId :: !TxId -- noreference
81+
{ maTxMint_Id :: !MaTxMintId
82+
, maTxMint_Quantity :: !DbInt65 -- sqltype=int65type
83+
, maTxMint_Ident :: !MultiAssetId -- noreference
84+
, maTxMint_TxId :: !TxId -- noreference
8485
} deriving (Eq, Show, Generic)
8586

86-
instance HasDbInfo MaTxMint where
87-
tableName _ = "ma_tx_mint"
88-
columnNames _ = NE.fromList [ "id" , "quantity" , "tx_id", "ident"]
89-
typeCasts _ = NE.fromList ["text[]", "jsonb[]", "bytea[]", "bigint[]"]
87+
instance HasDbInfo MaTxMint
9088

9189
maTxMintDecoder :: D.Row MaTxMint
9290
maTxMintDecoder =
@@ -99,9 +97,9 @@ maTxMintDecoder =
9997
maTxMintEncoder :: E.Params MaTxMint
10098
maTxMintEncoder =
10199
mconcat
102-
[ maTxMintQuantity >$< E.param (E.nonNullable dbInt65Encoder)
103-
, maTxMintIdent >$< idEncoder getMultiAssetId
104-
, maTxMintTxId >$< idEncoder getTxId
100+
[ maTxMint_Quantity >$< E.param (E.nonNullable dbInt65Encoder)
101+
, maTxMint_Ident >$< idEncoder getMultiAssetId
102+
, maTxMint_TxId >$< idEncoder getTxId
105103
]
106104

107105
maTxMintEncoderMany :: E.Params ([DbInt65], [MultiAssetId], [TxId])

cardano-db/src/Cardano/Db/Schema/Core/OffChain.hs

+201-200
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)