pressly / goose

A database migration tool. Supports SQL migrations and Go functions.
http://pressly.github.io/goose/
Other
7.08k stars 520 forks source link

YDB up not work #634

Closed flymedllva closed 1 year ago

flymedllva commented 1 year ago

first launch

goose -dir migrations -table goose_db_version ydb "grpc://localhost:2136/local?go_query_mode=scripting&go_fake_tx=scripting&go_query_bind=declare,numeric" up
2023/11/06 13:10:03 goose run: streamResult.NextResultSetErr(): connError(node_id = 1, address = "localhost:2136"): operation/SCHEME_ERROR (code = 400070, address = localhost:2136, issues = [{#1030 'Type annotation' [{2:37 => 'At function: KiReadTable!' [{2:37 => #2003 'Cannot find table 'db.[goose_db_version]' because it does not exist or you do not have access permissions. Please check correctness of table path and user permissions'}]}]}]) at `github.com/ydb-platform/ydb-go-sdk/v3/internal/conn.(*grpcClientStream).RecvMsg(grpc_client_stream.go:117)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/scripting.(*Client).streamExecute.func2(client.go:242)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/table/scanner.(*streamResult).NextResultSetErr(result.go:173)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/table/scanner.(*streamResult).Err(result.go:40)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/xsql.(*rows).Next(rows.go:110)`

at the same time, the table, judging by the UI YDB, was created

Screenshot 2023-11-06 at 13 12 49

second launch gets into a table conflict, although up with other databases in goose would work fine

goose -dir migrations -table goose_db_version ydb "grpc://localhost:2136/local?go_query_mode=scripting&go_fake_tx=scripting&go_query_bind=declare,numeric" up
2023/11/06 13:13:40 goose run: streamResult.NextResultSetErr(): connError(node_id = 1, address = "localhost:2136"): operation/PRECONDITION_FAILED (code = 400120, address = localhost:2136, issues = [{#1060 'Execution' [{#2012 'Conflict with existing key'}]}]) at `github.com/ydb-platform/ydb-go-sdk/v3/internal/conn.(*grpcClientStream).RecvMsg(grpc_client_stream.go:117)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/scripting.(*Client).streamExecute.func2(client.go:242)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/table/scanner.(*streamResult).NextResultSetErr(result.go:173)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/xsql.(*conn).execContext(conn.go:229)`

I tested it on the master version 8503d4e20b748a9771eb127fe056dc560ca81323 (master) & 0c243fb3c97a5dcacbcfe4229bc556f3d2dd5500 (YDB added)

flymedllva commented 1 year ago

FIY @gingersamurai @asmyasnikov

flymedllva commented 1 year ago

Apparently the YDB of the required version has not been released yet. On ghcr.io/ydb-platform/local-ydb:23.3 everything works

mfridman commented 1 year ago

Thanks for debugging, afaics we're using (v3.54.1) and testing against the latest server version (v23.3).

Is there anything to investigate here? 🤔