From 2d3e66e5272d2d2c04e42a41f1c3d67eceb6a117 Mon Sep 17 00:00:00 2001 From: Geoffrey Ragot Date: Fri, 1 Nov 2024 10:17:45 +0100 Subject: [PATCH] chore: reorder migrations --- go.mod | 2 +- internal/controller/ledger/controller_default.go | 2 +- .../controller/ledger/controller_default_test.go | 2 +- internal/controller/ledger/store.go | 2 +- internal/controller/ledger/store_generated_test.go | 12 ++++++------ .../notes.yaml | 0 .../up.sql | 0 .../notes.yaml | 0 .../{20-clean-database => 24-clean-database}/up.sql | 0 9 files changed, 10 insertions(+), 10 deletions(-) rename internal/storage/bucket/migrations/{19-accounts-recreate-unique-index => 23-accounts-recreate-unique-index}/notes.yaml (100%) rename internal/storage/bucket/migrations/{19-accounts-recreate-unique-index => 23-accounts-recreate-unique-index}/up.sql (100%) rename internal/storage/bucket/migrations/{20-clean-database => 24-clean-database}/notes.yaml (100%) rename internal/storage/bucket/migrations/{20-clean-database => 24-clean-database}/up.sql (100%) diff --git a/go.mod b/go.mod index 71e2c014c..1f9b008d5 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,6 @@ require ( github.com/onsi/gomega v1.34.2 github.com/ory/dockertest/v3 v3.11.0 github.com/pborman/uuid v1.2.1 - github.com/pkg/errors v0.9.1 github.com/shomali11/xsql v0.0.0-20190608141458-bf76292144df github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 @@ -54,6 +53,7 @@ require gopkg.in/yaml.v3 v3.0.1 // indirect require ( github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/jackc/pgxlisten v0.0.0-20241005155529-9d952acd6a6c // indirect + github.com/pkg/errors v0.9.1 // indirect ) require ( diff --git a/internal/controller/ledger/controller_default.go b/internal/controller/ledger/controller_default.go index d5d8bdf56..962284a11 100644 --- a/internal/controller/ledger/controller_default.go +++ b/internal/controller/ledger/controller_default.go @@ -239,7 +239,7 @@ func (ctrl *DefaultController) Export(ctx context.Context, w ExportWriter) error } func (ctrl *DefaultController) IsDatabaseUpToDate(ctx context.Context) (bool, error) { - return ctrl.store.IsUpToDate(ctx) + return ctrl.store.HasMinimalVersion(ctx) } func (ctrl *DefaultController) GetVolumesWithBalances(ctx context.Context, q GetVolumesWithBalancesQuery) (*bunpaginate.Cursor[ledger.VolumesWithBalanceByAssetByAccount], error) { diff --git a/internal/controller/ledger/controller_default_test.go b/internal/controller/ledger/controller_default_test.go index e6165068f..2550ceb80 100644 --- a/internal/controller/ledger/controller_default_test.go +++ b/internal/controller/ledger/controller_default_test.go @@ -395,7 +395,7 @@ func TestIsDatabaseUpToDate(t *testing.T) { ctx := logging.TestingContext() store.EXPECT(). - IsUpToDate(gomock.Any()). + HasMinimalVersion(gomock.Any()). Return(true, nil) l := NewDefaultController(ledger.Ledger{}, store, parser) diff --git a/internal/controller/ledger/store.go b/internal/controller/ledger/store.go index 55bc839c4..eba8bca10 100644 --- a/internal/controller/ledger/store.go +++ b/internal/controller/ledger/store.go @@ -65,7 +65,7 @@ type Store interface { GetAccount(ctx context.Context, q GetAccountQuery) (*ledger.Account, error) GetAggregatedBalances(ctx context.Context, q GetAggregatedBalanceQuery) (ledger.BalancesByAssets, error) GetVolumesWithBalances(ctx context.Context, q GetVolumesWithBalancesQuery) (*bunpaginate.Cursor[ledger.VolumesWithBalanceByAssetByAccount], error) - IsUpToDate(ctx context.Context) (bool, error) + HasMinimalVersion(ctx context.Context) (bool, error) GetMigrationsInfo(ctx context.Context) ([]migrations.Info, error) } diff --git a/internal/controller/ledger/store_generated_test.go b/internal/controller/ledger/store_generated_test.go index 1618ae7c3..4790273e8 100644 --- a/internal/controller/ledger/store_generated_test.go +++ b/internal/controller/ledger/store_generated_test.go @@ -361,19 +361,19 @@ func (mr *MockStoreMockRecorder) GetVolumesWithBalances(ctx, q any) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetVolumesWithBalances", reflect.TypeOf((*MockStore)(nil).GetVolumesWithBalances), ctx, q) } -// IsUpToDate mocks base method. -func (m *MockStore) IsUpToDate(ctx context.Context) (bool, error) { +// HasMinimalVersion mocks base method. +func (m *MockStore) HasMinimalVersion(ctx context.Context) (bool, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsUpToDate", ctx) + ret := m.ctrl.Call(m, "HasMinimalVersion", ctx) ret0, _ := ret[0].(bool) ret1, _ := ret[1].(error) return ret0, ret1 } -// IsUpToDate indicates an expected call of IsUpToDate. -func (mr *MockStoreMockRecorder) IsUpToDate(ctx any) *gomock.Call { +// HasMinimalVersion indicates an expected call of HasMinimalVersion. +func (mr *MockStoreMockRecorder) HasMinimalVersion(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsUpToDate", reflect.TypeOf((*MockStore)(nil).IsUpToDate), ctx) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasMinimalVersion", reflect.TypeOf((*MockStore)(nil).HasMinimalVersion), ctx) } // ListAccounts mocks base method. diff --git a/internal/storage/bucket/migrations/19-accounts-recreate-unique-index/notes.yaml b/internal/storage/bucket/migrations/23-accounts-recreate-unique-index/notes.yaml similarity index 100% rename from internal/storage/bucket/migrations/19-accounts-recreate-unique-index/notes.yaml rename to internal/storage/bucket/migrations/23-accounts-recreate-unique-index/notes.yaml diff --git a/internal/storage/bucket/migrations/19-accounts-recreate-unique-index/up.sql b/internal/storage/bucket/migrations/23-accounts-recreate-unique-index/up.sql similarity index 100% rename from internal/storage/bucket/migrations/19-accounts-recreate-unique-index/up.sql rename to internal/storage/bucket/migrations/23-accounts-recreate-unique-index/up.sql diff --git a/internal/storage/bucket/migrations/20-clean-database/notes.yaml b/internal/storage/bucket/migrations/24-clean-database/notes.yaml similarity index 100% rename from internal/storage/bucket/migrations/20-clean-database/notes.yaml rename to internal/storage/bucket/migrations/24-clean-database/notes.yaml diff --git a/internal/storage/bucket/migrations/20-clean-database/up.sql b/internal/storage/bucket/migrations/24-clean-database/up.sql similarity index 100% rename from internal/storage/bucket/migrations/20-clean-database/up.sql rename to internal/storage/bucket/migrations/24-clean-database/up.sql