-
Notifications
You must be signed in to change notification settings - Fork 1
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: add DBStructure schema #83
Conversation
cec3f3d
to
2533272
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.
The changes in packages/db-structure/src/schema/index.ts
look good, and it seems like updating just this file should be sufficient. What do you think?
@@ -1,9 +1,51 @@ | |||
import * as v from 'valibot' | |||
|
|||
const tablesSchema = v.object({}) | |||
const fieldSchema = v.object({ |
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.
👍
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.
Generally no problem 👍🏻
But I'm only commenting on the parts that would change the implementation significantly in the future.
2533272
to
9d85a7d
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.
Thanks for the adjustment!
I only commented on the details, but I will leave it to you!
deleteConstraint: v.string(), | ||
}) | ||
|
||
const tablesSchema = v.record(v.string(), tableSchema) // Key is table name |
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.
nits: If you are going to make comments like this, it is better to use the type alias practice:
const tablesSchema = v.record(v.string(), tableSchema) // Key is table name | |
const tableNameSchema = v.string() | |
const tablesSchema = v.record(tableNameSchema, tableSchema) |
Of course, it is also used for startTableName
, etc.
Improves readability by providing a link between which values are referenced and where.
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.
Thanks, added type alias:
6cde75d
Summary
This is an experimental schema and is likely to change in the near future.
As a first step, referencing drawDB, which offers functionality similar to our service.
https://github.com/drawdb-io/drawdb/blob/main/src/data/schemas.js
Related Issue
Changes
Testing
Other Information
Please note that some drawDB schemas have been removed for minimal start.