-
Notifications
You must be signed in to change notification settings - Fork 3
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
Separate schema files for each collection #14
Conversation
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.
Looks good!
// /// Currently only writes `schema.json` | ||
// pub async fn write_directory( | ||
// configuration_dir: impl AsRef<Path>, | ||
// configuration: &Configuration, | ||
// ) -> anyhow::Result<()> { | ||
// write_file(configuration_dir, SCHEMA_FILENAME, &configuration.schema).await | ||
// } |
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.
Just a little commented code here
@@ -42,4 +42,23 @@ impl Schema { | |||
.iter() | |||
.map(|(name, field)| WithNameRef::named(name, field)) | |||
} | |||
|
|||
/// Unify two schemas. Assumes that the schemas describe mutually exclusive sets of collections. | |||
pub fn merge(schema_a: Schema, schema_b: Schema) -> Schema { |
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.
Would it be helpful to emit errors if there are conflicting collection or object type names? I suppose if they're auto-generated it's not likely to come up
Describe your changes
Schema files will now be created and read from a subdirectory
schema/
containing one schema file per collection.If a collection already has a schema then the
update
command skip sampling from the database for that schema.Issue ticket number and link
https://hasurahq.atlassian.net/browse/MDB-83