From 8f07a8ca16313fcab9dcfa03644ce4dcc8d83941 Mon Sep 17 00:00:00 2001 From: Geoffrey Ragot Date: Fri, 1 Nov 2024 10:17:45 +0100 Subject: [PATCH] chore: reorder migrations --- internal/controller/ledger/controller_default.go | 2 +- internal/controller/ledger/store.go | 2 +- internal/controller/ledger/store_generated_test.go | 6 +++--- .../notes.yaml | 0 .../up.sql | 0 .../{20-clean-database => 24-clean-database}/notes.yaml | 0 .../{20-clean-database => 24-clean-database}/up.sql | 0 7 files changed, 5 insertions(+), 5 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/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/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..d92c1ba1c 100644 --- a/internal/controller/ledger/store_generated_test.go +++ b/internal/controller/ledger/store_generated_test.go @@ -362,9 +362,9 @@ func (mr *MockStoreMockRecorder) GetVolumesWithBalances(ctx, q any) *gomock.Call } // IsUpToDate mocks base method. -func (m *MockStore) IsUpToDate(ctx context.Context) (bool, error) { +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 @@ -373,7 +373,7 @@ func (m *MockStore) IsUpToDate(ctx context.Context) (bool, error) { // IsUpToDate indicates an expected call of IsUpToDate. func (mr *MockStoreMockRecorder) IsUpToDate(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