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

Node API to migrate lock files #598

Merged
merged 4 commits into from
Nov 18, 2023
Merged

Node API to migrate lock files #598

merged 4 commits into from
Nov 18, 2023

Conversation

adzialocha
Copy link
Member

@adzialocha adzialocha commented Nov 17, 2023

Introduces a migrate method on the Node struct to programmatically allow schema migrations and seeds.

let data = include_str!("schema.lock");
let lock_file: LockFile = toml::from_str(&data).expect("error parsing schema.lock file");
let node = Node::start(KeyPair::new(), Configuration::default()).await;
node.migrate(lock_file).await.expect("Migration failed");

This is maybe also a first step towards a general "low-level" API to interact with aquadoggo, for this we might want a NodeBuilder pattern instead to configure the node, while developers can use then the resulting Node itself to interact, but since this is a larger API change we should think this through a bit more.

Closes #597

📋 Checklist

  • Add tests that cover your changes
  • Add this PR to the Unreleased section in CHANGELOG.md
  • Link this PR to any issues it closes
  • New files contain a SPDX license header

@adzialocha adzialocha requested a review from sandreae November 17, 2023 17:38
@adzialocha adzialocha marked this pull request as ready for review November 17, 2023 17:42
Copy link
Member

@sandreae sandreae left a comment

Choose a reason for hiding this comment

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

Looks great to me! I tested it out a bit and didn't come across any issues.

@adzialocha adzialocha merged commit 8e21b6a into main Nov 18, 2023
8 checks passed
@adzialocha adzialocha deleted the migration-api branch November 18, 2023 09:54
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.

migrate API to allow bootstrapping schema data on launch of node
2 participants