Skip to content

Commit 1ca91b8

Browse files
committed
feat: index multiple table columns
1 parent d96a4e1 commit 1ca91b8

File tree

12 files changed

+31
-31
lines changed

12 files changed

+31
-31
lines changed

packages/fasset-indexer-core/src/orm/entities/events/agent.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class UnderlyingWithdrawalAnnounced extends AgentEventBound {
5252
@Property({ type: new uint64() })
5353
announcementId!: bigint
5454

55-
@Property({ type: 'string' })
55+
@Property({ type: 'string', index: true })
5656
paymentReference!: string
5757
}
5858

@@ -65,7 +65,7 @@ export class UnderlyingWithdrawalConfirmed extends FAssetEventBound {
6565
@Property({ type: new uint256() })
6666
spendUBA!: bigint
6767

68-
@Property({ type: 'string' })
68+
@Property({ type: 'string', index: true })
6969
transactionHash!: string
7070
}
7171

@@ -79,7 +79,7 @@ export class UnderlyingWithdrawalCancelled extends FAssetEventBound {
7979
@Entity()
8080
export class UnderlyingBalanceToppedUp extends AgentEventBound {
8181

82-
@Property({ type: 'text' })
82+
@Property({ type: 'text', index: true })
8383
transactionHash!: string
8484

8585
@Property({ type: new uint256() })

packages/fasset-indexer-core/src/orm/entities/events/core-vault-manager.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class CoreVaultManagerPaymentConfirmed extends FAssetEventBound {
3535
@Property({ type: 'text', length: BYTES32_LENGTH, unique: true })
3636
transactionId!: string
3737

38-
@Property({ type: 'text' })
38+
@Property({ type: 'text', index: true })
3939
paymentReference!: string
4040

4141
@Property({ type: new uint256() })
@@ -45,7 +45,7 @@ export class CoreVaultManagerPaymentConfirmed extends FAssetEventBound {
4545
@Entity()
4646
export class CoreVaultManagerPaymentInstructions extends FAssetEventBound {
4747

48-
@Property({ type: new uint256() })
48+
@Property({ type: new uint256(), index: true })
4949
sequence!: bigint
5050

5151
@ManyToOne({ entity: () => UnderlyingAddress })
@@ -60,17 +60,17 @@ export class CoreVaultManagerPaymentInstructions extends FAssetEventBound {
6060
@Property({ type: new uint256() })
6161
fee!: bigint
6262

63-
@Property({ type: 'text', length: BYTES32_LENGTH })
63+
@Property({ type: 'text', length: BYTES32_LENGTH, index: true })
6464
paymentReference!: string
6565
}
6666

6767
@Entity()
6868
export class CoreVaultManagerEscrowInstructions extends FAssetEventBound {
6969

70-
@Property({ type: new uint256() })
70+
@Property({ type: new uint256(), index: true })
7171
sequence!: bigint
7272

73-
@Property({ type: 'text', length: BYTES32_LENGTH })
73+
@Property({ type: 'text', length: BYTES32_LENGTH, index: true })
7474
preimageHash!: string
7575

7676
@ManyToOne({ entity: () => UnderlyingAddress })
@@ -95,7 +95,7 @@ export class CoreVaultManagerTransferRequested extends FAssetEventBound {
9595
@ManyToOne({ entity: () => UnderlyingAddress })
9696
destination!: UnderlyingAddress
9797

98-
@Property({ type: 'text', length: BYTES32_LENGTH })
98+
@Property({ type: 'text', length: BYTES32_LENGTH, index: true })
9999
paymentReference!: string
100100

101101
@Property({ type: new uint256() })
@@ -111,7 +111,7 @@ export class CoreVaultManagerTransferRequestCanceled extends FAssetEventBound {
111111
@ManyToOne({ entity: () => UnderlyingAddress })
112112
destination!: UnderlyingAddress
113113

114-
@Property({ type: 'text', length: BYTES32_LENGTH })
114+
@Property({ type: 'text', length: BYTES32_LENGTH, index: true })
115115
paymentReference!: string
116116

117117
@Property({ type: new uint256() })
@@ -124,7 +124,7 @@ export class CoreVaultManagerNotAllEscrowsProcessed extends FAssetEventBound {}
124124
@Entity()
125125
export class EscrowExpired extends FAssetEventBound {
126126

127-
@Property({ type: 'text', length: BYTES32_LENGTH })
127+
@Property({ type: 'text', length: BYTES32_LENGTH, index: true })
128128
preimageHash!: string
129129

130130
@Property({ type: new uint256() })
@@ -134,7 +134,7 @@ export class EscrowExpired extends FAssetEventBound {
134134
@Entity()
135135
export class EscrowFinished extends FAssetEventBound {
136136

137-
@Property({ type: 'text', length: BYTES32_LENGTH })
137+
@Property({ type: 'text', length: BYTES32_LENGTH, index: true })
138138
preimageHash!: string
139139

140140
@Property({ type: new uint256() })

packages/fasset-indexer-core/src/orm/entities/events/core-vault.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { BYTES32_LENGTH } from "../../../config/constants"
1010
@Unique({ properties: ['fasset', 'transferRedemptionRequestId'] })
1111
export class TransferToCoreVaultStarted extends AgentEventBound {
1212

13-
@Property({ type: 'number' })
13+
@Property({ type: 'number', index: true })
1414
transferRedemptionRequestId!: number
1515

1616
@Property({ type: new uint64() })
@@ -41,10 +41,10 @@ export class TransferToCoreVaultSuccessful extends FAssetEventBound {
4141
@Unique({ properties: ['fasset', 'requestId'] })
4242
export class ReturnFromCoreVaultRequested extends AgentEventBound {
4343

44-
@Property({ type: 'number' })
44+
@Property({ type: 'number', index: true })
4545
requestId!: number
4646

47-
@Property({ type: 'text', length: BYTES32_LENGTH })
47+
@Property({ type: 'text', length: BYTES32_LENGTH, index: true })
4848
paymentReference!: string
4949

5050
@Property({ type: new uint256() })
@@ -80,7 +80,7 @@ export class CoreVaultRedemptionRequested extends FAssetEventBound {
8080
@ManyToOne({ entity: () => UnderlyingAddress })
8181
paymentAddress!: UnderlyingAddress
8282

83-
@Property({ type: 'text', length: BYTES32_LENGTH, nullable: true })
83+
@Property({ type: 'text', length: BYTES32_LENGTH, nullable: true, index: true })
8484
paymentReference!: string
8585

8686
@Property({ type: new uint256() })

packages/fasset-indexer-core/src/orm/entities/events/minting.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { BYTES32_LENGTH } from '../../../config/constants'
1111
@Unique({ properties: ['fasset', 'collateralReservationId'] })
1212
export class CollateralReserved extends AgentEventBound {
1313

14-
@Property({ type: 'number' })
14+
@Property({ type: 'number', index: true })
1515
collateralReservationId!: number
1616

1717
@ManyToOne({ entity: () => EvmAddress })
@@ -35,7 +35,7 @@ export class CollateralReserved extends AgentEventBound {
3535
@ManyToOne({ entity: () => UnderlyingAddress})
3636
paymentAddress!: UnderlyingAddress
3737

38-
@Property({ type: 'text', length: BYTES32_LENGTH })
38+
@Property({ type: 'text', length: BYTES32_LENGTH, index: true })
3939
paymentReference!: string
4040

4141
@ManyToOne({ entity: () => EvmAddress })

packages/fasset-indexer-core/src/orm/entities/events/price.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { EventBound } from './_bound'
55
@Entity()
66
export class PricesPublished extends EventBound {
77

8-
@Property({ type: 'number' })
8+
@Property({ type: 'number', index: true })
99
votingRoundId!: number
1010
}
1111

@@ -18,7 +18,7 @@ export class PricePublished {
1818
@ManyToOne({ entity: () => PricesPublished })
1919
pricesPublished!: PricesPublished
2020

21-
@Property({ type: 'text' })
21+
@Property({ type: 'text', index: true })
2222
symbol!: string
2323

2424
@Property({ type: 'bigint' })

packages/fasset-indexer-core/src/orm/entities/events/redemption-ticket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { AgentEventBound, FAssetEventBound } from "./_bound"
77
@Unique({ properties: ['fasset', 'redemptionTicketId'] })
88
export class RedemptionTicketCreated extends AgentEventBound {
99

10-
@Property({ type: new uint64() })
10+
@Property({ type: new uint64(), index: true })
1111
redemptionTicketId!: bigint
1212

1313
@Property({ type: new uint256() })

packages/fasset-indexer-core/src/orm/entities/events/redemption.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { BYTES32_LENGTH } from "../../../config/constants"
1111
@Unique({ properties: ['fasset', 'paymentReference'] })
1212
export class RedemptionRequested extends AgentEventBound {
1313

14-
@Property({ type: 'number' })
14+
@Property({ type: 'number', index: true })
1515
requestId!: number
1616

1717
@ManyToOne({ entity: () => EvmAddress })
@@ -35,7 +35,7 @@ export class RedemptionRequested extends AgentEventBound {
3535
@Property({ type: 'number' })
3636
lastUnderlyingTimestamp!: number
3737

38-
@Property({ type: 'text', length: BYTES32_LENGTH })
38+
@Property({ type: 'text', length: BYTES32_LENGTH, index: true })
3939
paymentReference!: string
4040

4141
@ManyToOne({ entity: () => EvmAddress })
@@ -84,7 +84,7 @@ export class RedemptionPaymentBlocked extends FAssetEventBound {
8484
@OneToOne({ entity: () => RedemptionRequested, owner: true })
8585
redemptionRequested!: RedemptionRequested
8686

87-
@Property({ type: 'text', length: BYTES32_LENGTH })
87+
@Property({ type: 'text', length: BYTES32_LENGTH, index: true })
8888
transactionHash!: string
8989

9090
@Property({ type: new uint256() })
@@ -97,13 +97,13 @@ export class RedemptionPaymentFailed extends FAssetEventBound {
9797
@OneToOne({ entity: () => RedemptionRequested, owner: true })
9898
redemptionRequested!: RedemptionRequested
9999

100-
@Property({ type: 'text', length: BYTES32_LENGTH })
100+
@Property({ type: 'text', length: BYTES32_LENGTH, index: true })
101101
transactionHash!: string
102102

103103
@Property({ type: new uint256() })
104104
spentUnderlyingUBA!: bigint
105105

106-
@Property({ type: 'text' })
106+
@Property({ type: 'text', index: true })
107107
failureReason!: string
108108
}
109109

packages/fasset-indexer-core/src/orm/entities/events/system.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { uint64 } from "../../custom/uint"
88
@Entity()
99
export class CurrentUnderlyingBlockUpdated extends FAssetEventBound {
1010

11-
@Property({ type: 'number' })
11+
@Property({ type: 'number', index: true })
1212
underlyingBlockNumber!: number
1313

1414
@Property({ type: 'number' })

packages/fasset-indexer-core/src/orm/entities/evm/block.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ export class EvmBlock {
77
@PrimaryKey({ type: "number" })
88
index!: number
99

10-
@Property({ type: "number" })
10+
@Property({ type: "number", index: true })
1111
timestamp!: number
1212
}

packages/fasset-indexer-core/src/orm/entities/evm/log.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class EvmLog {
1111
@PrimaryKey({ type: "number", autoincrement: true })
1212
id!: number
1313

14-
@Property({ type: "number" })
14+
@Property({ type: "number", index: true })
1515
index!: number
1616

1717
@Property({ type: "text" })

0 commit comments

Comments
 (0)