Skip to content
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: generate SQL table schema from JSON Schemas [1/n] #140

Closed
wants to merge 2 commits into from

Conversation

gmaclennan
Copy link
Member

@gmaclennan gmaclennan commented Aug 1, 2023

Generate drizzle-orm SQLite table schemas from Mapeo types & JSONSchemas.
(Currently uses unpublished version of @mapeo/schema that exports JSONSchemas with expanded $refs)

@gmaclennan gmaclennan linked an issue Aug 1, 2023 that may be closed by this pull request
@gmaclennan
Copy link
Member Author

Now finished and ready for review, but awaiting publishing of new version of @mapeo/schema.

Will be stacking other PRs on this, working on #139

@gmaclennan gmaclennan self-assigned this Aug 3, 2023
Squashed commits:
[a8267eb] Switch moduleResolution so @digidem/types work
[1205a2b] Fixes and add forks
[981070a] Add tests and fix accordingly
[2dac678] Add tests and fixes
[01ac065] add types for brittle
[537ff7a] Add project, preset, field schemas
[ad186ae] cleanup code and add comments
[c23cf09] fix: extract correct schema w/out schemaName param
[d8786c8] fix: docId as primary key
[36eda92] fix enum type
[f0c7eed] Remove db artifact
[89468e2] WIP: Generate SQL table schema from JSON Schemas
@gmaclennan gmaclennan force-pushed the feat/jsonschema-to-sql-schema branch from 981070a to 4da0146 Compare August 7, 2023 15:14
@gmaclennan gmaclennan changed the title feat: generate SQL table schema from JSON Schemas feat: generate SQL table schema from JSON Schemas [1/n] Aug 7, 2023
@gmaclennan gmaclennan requested a review from achou11 August 7, 2023 15:34
@gmaclennan gmaclennan marked this pull request as ready for review August 7, 2023 15:35
Copy link
Member

@achou11 achou11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good! curious about what else to add to the tests, if anything

lib/schema/schema-to-drizzle.js Show resolved Hide resolved
lib/schema/schema-to-drizzle.js Show resolved Hide resolved
@gmaclennan
Copy link
Member Author

overall looks good! curious about what else to add to the tests, if anything

I think more type tests would be good, but probably make more sense to be end-to-end tests rather than unit-testing just this function.

TODO: Figure out best way to test types
@@ -0,0 +1,84 @@
// Types generated from brittle readme with chatgpt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed?

@gmaclennan
Copy link
Member Author

Merged in #149

@gmaclennan gmaclennan closed this Aug 9, 2023
@gmaclennan gmaclennan deleted the feat/jsonschema-to-sql-schema branch August 31, 2023 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create sqlite index tables from JSONSchema definitions in @mapeo/schema
3 participants