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

Separate schema files for each collection #14

Merged
merged 9 commits into from
Mar 27, 2024

Conversation

dmoverton
Copy link
Contributor

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

@dmoverton dmoverton requested a review from hallettj March 26, 2024 05:33
@dmoverton dmoverton self-assigned this Mar 26, 2024
Copy link
Collaborator

@hallettj hallettj left a comment

Choose a reason for hiding this comment

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

Looks good!

Comment on lines 147 to 153
// /// 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
// }
Copy link
Collaborator

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 {
Copy link
Collaborator

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

@dmoverton dmoverton merged commit 4c9af83 into main Mar 27, 2024
1 check passed
@dmoverton dmoverton deleted the dmoverton/schema-directory branch March 27, 2024 01:06
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.

2 participants