Skip to content

Commit

Permalink
fix(db): change prover_block_list's index on public_key from non-uniq…
Browse files Browse the repository at this point in the history
…ue to unique (#1294)

Co-authored-by: HAOYUatHZ <HAOYUatHZ@users.noreply.github.com>
  • Loading branch information
amoylan2 and HAOYUatHZ authored Apr 24, 2024
1 parent 8f8f6eb commit 72ee087
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion common/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime/debug"
)

var tag = "v4.4.0"
var tag = "v4.4.1"

var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
Expand Down
6 changes: 3 additions & 3 deletions database/migrate/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,20 @@ func testResetDB(t *testing.T) {
cur, err := Current(pgDB)
assert.NoError(t, err)
// total number of tables.
assert.Equal(t, int64(19), cur)
assert.Equal(t, int64(20), cur)
}

func testMigrate(t *testing.T) {
assert.NoError(t, Migrate(pgDB))
cur, err := Current(pgDB)
assert.NoError(t, err)
assert.Equal(t, int64(19), cur)
assert.Equal(t, int64(20), cur)
}

func testRollback(t *testing.T) {
version, err := Current(pgDB)
assert.NoError(t, err)
assert.Equal(t, int64(19), version)
assert.Equal(t, int64(20), version)

assert.NoError(t, Rollback(pgDB, nil))

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- +goose Up
-- +goose StatementBegin

DROP INDEX if exists idx_prover_block_list_on_public_key;

CREATE UNIQUE INDEX if not exists uniq_prover_block_list_on_public_key ON prover_block_list(public_key) where deleted_at IS NULL;

-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin

CREATE INDEX if not exists idx_prover_block_list_on_public_key ON prover_block_list(public_key);

DROP INDEX if exists uniq_prover_block_list_on_public_key;

-- +goose StatementEnd

0 comments on commit 72ee087

Please sign in to comment.