Use generic schema definitions #90
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changes the schema provided over the API to primarily provide a sqlite type, rather than a postgres type. It's more than just renaming the field - the conversion to the SQLite type now happens in the service (in the specific module), rather than the client.
Each column now primarily has:
sqlite_type
: The type as it will behave in sync rules.internal_type
: The original type from the source database. This should not be used to check the type in code, but can be used for descriptions in auto-complete or generated schemas.The old
pg_type
andtype
fields are still kept as is, to preserve backwards-compatibility. However, these do not need to be populated by other modules, and can be removed later.This now also refactors internals to keep the original type (internal_type) available in the output schema after going through sync rules, allowing us to annotate the generated schema with comments like this: