diff --git a/internal/moves.go b/internal/moves.go index 22388dda3..ebd930e4f 100644 --- a/internal/moves.go +++ b/internal/moves.go @@ -12,7 +12,6 @@ import ( type Move struct { bun.BaseModel `bun:"table:moves"` - Ledger string `bun:"ledger,type:varchar"` TransactionID int `bun:"transactions_id,type:bigint"` IsSource bool `bun:"is_source,type:bool"` Account string `bun:"accounts_address,type:varchar"` diff --git a/internal/storage/ledger/moves.go b/internal/storage/ledger/moves.go index 4affe8475..e41934fc2 100644 --- a/internal/storage/ledger/moves.go +++ b/internal/storage/ledger/moves.go @@ -57,6 +57,7 @@ func (s *Store) InsertMoves(ctx context.Context, moves ...*ledger.Move) error { _, err := tracing.TraceWithLatency(ctx, "InsertMoves", tracing.NoResult(func(ctx context.Context) error { _, err := s.db.NewInsert(). Model(&moves). + Value("ledger", "?", s.ledger.Name). ModelTableExpr(s.GetPrefixedRelationName("moves")). Returning("post_commit_volumes, post_commit_effective_volumes"). Exec(ctx) diff --git a/internal/storage/ledger/moves_test.go b/internal/storage/ledger/moves_test.go index 05656d923..3ccc44b1a 100644 --- a/internal/storage/ledger/moves_test.go +++ b/internal/storage/ledger/moves_test.go @@ -54,7 +54,6 @@ func TestMovesInsert(t *testing.T) { // Insert a first move at t0 m1 := ledger.Move{ - Ledger: store.GetLedger().Name, IsSource: true, Account: "world", Amount: (*bunpaginate.BigInt)(big.NewInt(100)), @@ -71,7 +70,6 @@ func TestMovesInsert(t *testing.T) { // Add a second move at t3 m2 := ledger.Move{ - Ledger: store.GetLedger().Name, IsSource: false, Account: "world", Amount: (*bunpaginate.BigInt)(big.NewInt(50)), @@ -88,7 +86,6 @@ func TestMovesInsert(t *testing.T) { // Add a third move at t1 m3 := ledger.Move{ - Ledger: store.GetLedger().Name, IsSource: true, Account: "world", Amount: (*bunpaginate.BigInt)(big.NewInt(200)), @@ -105,7 +102,6 @@ func TestMovesInsert(t *testing.T) { // Add a fourth move at t2 m4 := ledger.Move{ - Ledger: store.GetLedger().Name, IsSource: false, Account: "world", Amount: (*bunpaginate.BigInt)(big.NewInt(50)), @@ -122,7 +118,6 @@ func TestMovesInsert(t *testing.T) { // Add a fifth move at t4 m5 := ledger.Move{ - Ledger: store.GetLedger().Name, IsSource: false, Account: "world", Amount: (*bunpaginate.BigInt)(big.NewInt(50)), diff --git a/internal/storage/ledger/transactions.go b/internal/storage/ledger/transactions.go index 4da5e8d06..b7046182a 100644 --- a/internal/storage/ledger/transactions.go +++ b/internal/storage/ledger/transactions.go @@ -266,7 +266,6 @@ func (s *Store) CommitTransaction(ctx context.Context, tx *ledger.Transaction) e for _, posting := range postings { moves = append(moves, &ledger.Move{ - Ledger: s.ledger.Name, Account: posting.Destination, Amount: (*bunpaginate.BigInt)(posting.Amount), Asset: posting.Asset, @@ -278,7 +277,6 @@ func (s *Store) CommitTransaction(ctx context.Context, tx *ledger.Transaction) e postCommitVolumes.AddInput(posting.Destination, posting.Asset, new(big.Int).Neg(posting.Amount)) moves = append(moves, &ledger.Move{ - Ledger: s.ledger.Name, IsSource: true, Account: posting.Source, Amount: (*bunpaginate.BigInt)(posting.Amount),