diff --git a/go.mod b/go.mod index a60b24e4d..27f4a979f 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 github.com/bluele/gcache v0.0.2 github.com/dop251/goja v0.0.0-20241009100908-5f46f2705ca3 - github.com/formancehq/go-libs/v2 v2.0.1-0.20241028132101-79fdac271c18 + github.com/formancehq/go-libs/v2 v2.0.1-0.20241028161955-be554f388de7 github.com/formancehq/ledger/pkg/client v0.0.0-00010101000000-000000000000 github.com/go-chi/chi/v5 v5.1.0 github.com/go-chi/cors v1.2.1 diff --git a/go.sum b/go.sum index 697951814..f85cc5863 100644 --- a/go.sum +++ b/go.sum @@ -104,8 +104,26 @@ github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/formancehq/go-libs/v2 v2.0.1-0.20241028132101-79fdac271c18 h1:jgMaxZfpdNz5hb92TcuvN0v0InfylF6u2NkzAhVioN4= -github.com/formancehq/go-libs/v2 v2.0.1-0.20241028132101-79fdac271c18/go.mod h1:DTqSp28pYPZa4O1WrOg3kobhgTHdk9geGtxnws9EViM= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028155556-d56bec25d266 h1:G57P9cvdG1oHp6qavoYsnXQDTXNuUY/gUlxj8AdbYCI= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028155556-d56bec25d266/go.mod h1:DTqSp28pYPZa4O1WrOg3kobhgTHdk9geGtxnws9EViM= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028160004-e58b3f4ea8d9 h1:ILdIt5YfROlkNk6AiTtTfAi2OQzS/BQFwhAKzD+HY34= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028160004-e58b3f4ea8d9/go.mod h1:DTqSp28pYPZa4O1WrOg3kobhgTHdk9geGtxnws9EViM= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028160124-4263e7785732 h1:jfaIqaU57yElLhCHj0414izr03OI2j4OUJa6YhFmZts= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028160124-4263e7785732/go.mod h1:DTqSp28pYPZa4O1WrOg3kobhgTHdk9geGtxnws9EViM= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028160543-e625b7eb8e51 h1:Y83CuW0Y4BbBJ8DU/e4jbxbVqmcBQ7g8WCol+KxV2q0= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028160543-e625b7eb8e51/go.mod h1:DTqSp28pYPZa4O1WrOg3kobhgTHdk9geGtxnws9EViM= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028161241-89e3c87c57bc h1:Objks34fOXunYxpcM27ELZiIxUgmoYAS6jytuti3XnE= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028161241-89e3c87c57bc/go.mod h1:DTqSp28pYPZa4O1WrOg3kobhgTHdk9geGtxnws9EViM= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028161453-ae6170b7292c h1:+Jrofg7N5I34696qzQB3+3q9NMXGLwTaJT9i4E/+B1Y= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028161453-ae6170b7292c/go.mod h1:DTqSp28pYPZa4O1WrOg3kobhgTHdk9geGtxnws9EViM= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028161554-af404c456fb0 h1:zaTH7VwOhh8NYXVNiuobnlbyxq3c+sH4bAmJGI4sEEI= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028161554-af404c456fb0/go.mod h1:DTqSp28pYPZa4O1WrOg3kobhgTHdk9geGtxnws9EViM= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028161753-ce8a786ab660 h1:6M69vS7HDnfP7uWTVvcf9fJMpO+FqJoRDDmPCFVk+ds= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028161753-ce8a786ab660/go.mod h1:DTqSp28pYPZa4O1WrOg3kobhgTHdk9geGtxnws9EViM= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028161858-847ed1327254 h1:KukRMj3OWUzPzqFMWmbAMtdb1klE4ixtzw4hbZ8mf3c= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028161858-847ed1327254/go.mod h1:DTqSp28pYPZa4O1WrOg3kobhgTHdk9geGtxnws9EViM= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028161955-be554f388de7 h1:PGSYMvrTg5CWhhfJYONfUBybFsCa+NKx6J1MIXDi9tw= +github.com/formancehq/go-libs/v2 v2.0.1-0.20241028161955-be554f388de7/go.mod h1:DTqSp28pYPZa4O1WrOg3kobhgTHdk9geGtxnws9EViM= github.com/formancehq/numscript v0.0.9-0.20241009144012-1150c14a1417 h1:LOd5hxnXDIBcehFrpW1OnXk+VSs0yJXeu1iAOO+Hji4= github.com/formancehq/numscript v0.0.9-0.20241009144012-1150c14a1417/go.mod h1:btuSv05cYwi9BvLRxVs5zrunU+O1vTgigG1T6UsawcY= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= diff --git a/internal/storage/bucket/migrations/13-transactions-fill-inserted-at/up.sql b/internal/storage/bucket/migrations/13-transactions-fill-inserted-at/up.sql index e3fc7e03e..58fac0dc4 100644 --- a/internal/storage/bucket/migrations/13-transactions-fill-inserted-at/up.sql +++ b/internal/storage/bucket/migrations/13-transactions-fill-inserted-at/up.sql @@ -2,7 +2,7 @@ do $$ declare _batch_size integer := 30; _date timestamp without time zone; - _count integer; + _count integer := 0; begin set search_path = '{{.Schema}}'; @@ -17,7 +17,8 @@ do $$ perform pg_notify('migrations-{{ .Schema }}', 'init: ' || _count); - for i in 0.._count by _batch_size loop + for i in 1.._count by _batch_size loop + -- todo: disable triggers! update transactions set inserted_at = ( select date @@ -29,7 +30,6 @@ do $$ commit; perform pg_notify('migrations-{{ .Schema }}', 'continue: 1'); - end loop; end $$; \ No newline at end of file diff --git a/internal/storage/module.go b/internal/storage/module.go index 1897c97e6..7902459d6 100644 --- a/internal/storage/module.go +++ b/internal/storage/module.go @@ -6,6 +6,7 @@ import ( "github.com/formancehq/go-libs/v2/logging" "github.com/formancehq/ledger/internal/storage/driver" "go.uber.org/fx" + "time" ) func NewFXModule(autoUpgrade bool) fx.Option { @@ -44,6 +45,8 @@ func NewFXModule(autoUpgrade bool) fx.Option { return } logging.FromContext(ctx).Errorf("Upgrading buckets: %s", err) + // todo: make configurable + <-time.After(5 * time.Second) continue } return