Skip to content

Commit

Permalink
update mtg and drop unused sql columns
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricfung committed Aug 12, 2024
1 parent bc02ba7 commit d57b8d3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
15 changes: 12 additions & 3 deletions cmd/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func mtgFixCache(ctx context.Context, path string) {
}
defer txn.Rollback()

key := "FIX:0d996abd53c1d8103c024939a2ce2fd67170508b"
key := "FIX:0d996abd53c1d8103c024939a2ce2fd67170508b:1"
row := txn.QueryRowContext(ctx, "SELECT value FROM properties WHERE key=?", key)
err = row.Scan(&key)
if err == sql.ErrNoRows {
Expand All @@ -41,12 +41,21 @@ func mtgFixCache(ctx context.Context, path string) {
return
}

query := "DELETE FROM caches"
_, err = txn.ExecContext(ctx, query)
invalidate := "DELETE FROM caches;\n"
_, err = txn.ExecContext(ctx, invalidate)
if err != nil {
panic(err)
}

alter := "ALTER TABLE outputs DROP COLUMN mask;\n"
alter = alter + "ALTER TABLE outputs DROP COLUMN keys;\n"
alter = alter + "ALTER TABLE outputs DROP COLUMN receivers;\n"
_, err = txn.ExecContext(ctx, invalidate)
if err != nil {
panic(err)
}

query := invalidate + alter
_, err = txn.ExecContext(ctx, "INSERT INTO properties (key, value, created_at, updated_at) VALUES (?, ?, ?, ?)",
key, query, time.Now().UTC(), time.Now().UTC())
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/MixinNetwork/bot-api-go-client/v3 v3.7.4
github.com/MixinNetwork/mixin v0.18.12
github.com/MixinNetwork/multi-party-sig v0.4.1
github.com/MixinNetwork/trusted-group v0.9.1-0.20240812121908-d7e2019aad6e
github.com/MixinNetwork/trusted-group v0.9.1-0.20240812155646-5419bbe78838
github.com/btcsuite/btcd v0.24.2
github.com/btcsuite/btcd/btcec/v2 v2.3.4
github.com/btcsuite/btcd/btcutil v1.1.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ github.com/MixinNetwork/mixin v0.18.12 h1:hMHaZUe9k65C7goDrKAlOHlMJHDvB1wTf9QxQE
github.com/MixinNetwork/mixin v0.18.12/go.mod h1:46byqFCaEelxJKspfEcJ5gEYTdE4FabPMV57DfiYDU8=
github.com/MixinNetwork/multi-party-sig v0.4.1 h1:rQdIVSDQQOUMub8ERDV1gbFHxGSD5/+Ve7gj5hGHiPs=
github.com/MixinNetwork/multi-party-sig v0.4.1/go.mod h1:mnZyPutnRV2+E6z3v5TpTb7q4HnS7IplS0yy4dPjVGA=
github.com/MixinNetwork/trusted-group v0.9.1-0.20240812121908-d7e2019aad6e h1:AEYFyws7ZPYQvSYbKgVQj0EqAC/LhqmCbWlOdcfPVUI=
github.com/MixinNetwork/trusted-group v0.9.1-0.20240812121908-d7e2019aad6e/go.mod h1:IS9wRax7PWhhx7b4pPjydyheiPLkX/sVceNny1Eqa1I=
github.com/MixinNetwork/trusted-group v0.9.1-0.20240812155646-5419bbe78838 h1:SZdbAsKmR3+O55qrYaOjd1r6bT9n155WzzZ9ajLttNU=
github.com/MixinNetwork/trusted-group v0.9.1-0.20240812155646-5419bbe78838/go.mod h1:IS9wRax7PWhhx7b4pPjydyheiPLkX/sVceNny1Eqa1I=
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
github.com/aead/siphash v1.0.1 h1:FwHfE/T45KPKYuuSAKyyvE+oPWcaQ+CUmFW0bPlM+kg=
Expand Down

0 comments on commit d57b8d3

Please sign in to comment.