-
-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: map strings to UUIDs (#809) #840
Conversation
@zepatrik what about this PR? |
This is quite a lot of work. The part done already can't be merged yet 'cause it touches migrations and they might need adjustment. |
208be6a
to
01463b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, I just have some conceptual thing to discuss tomorrow.
contrib/docs-code-samples/list-api-display-objects/99-cleanup/index.js
Outdated
Show resolved
Hide resolved
internal/persistence/sql/migrations/migratest/migration_test.go
Outdated
Show resolved
Hide resolved
Co-authored-by: Patrik <[email protected]>
In relation tuples and related API objects such as queries, subjects (including subject sets) and objects are now automatically mapped to and from UUIDs. The mapping is done in each handler and for each protocol (HTTP, gRPC) separately. Below the handler, all objects and subjects are now UUIDs, but still handled as strings, for the following reasons: * No duplication of datastructures (one for type `string`, one for type `uuid.UUID`). * No unnecessary copying, the mapping is done in-place and batched across multiple objects. Additionally, the migration (adding the string values to the mapping table and replacing the values with UUIDs) is now performed automatically as part of the migrations. Tests are in `migratest`, which now also handles `GoMigrations` properly. This method replaces the dedicated command in `cmd/migrate/...` for the UUID mappings.
Sorting the expected output of the docs tests make the tests more robust.
resolves `table locked` errors with sqlite
Database tests now run in separate databases, which opens up the opportunity to run them in parallel.
Database tests now run in separate databases, which opens up the opportunity to run them in parallel.
# Conflicts: # go.mod # go.sum # internal/driver/registry_default.go # internal/persistence/sql/migrations/migratest/migration_test.go # internal/persistence/sql/relationtuples.go # internal/x/dbx/dsn_cockroach.go # internal/x/dbx/dsn_mysql.go # internal/x/dbx/dsn_postgres.go # internal/x/dbx/dsn_sqlite.go # internal/x/dbx/dsn_testutils.go
e2bf8b3
to
2fc02fa
Compare
# Conflicts: # go.sum
# Conflicts: # go.sum # internal/e2e/helpers.go # internal/persistence/sql/full_test.go # internal/persistence/sql/relationtuples.go # internal/relationtuple/manager_requirements.go
internal/persistence/sql/migrations/migratest/migration_test.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very good! I have some minor comments/questions, but nothing that should hold this up for long.
# Conflicts: # go.mod # go.sum
Namespaces are now only identified by their name, not by their ID. The 'ID' entries in the configuration are still supported, and used for down-migrations when reverting to a schema that still uses the namespace IDs.
Related issue(s)
closes #792
Further Comments
Current State:
Next steps:
In the end, we will rebase.