-
Notifications
You must be signed in to change notification settings - Fork 23
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
Hooks #1449
base: master
Are you sure you want to change the base?
Hooks #1449
Conversation
d3deae9
to
bea254b
Compare
9cf7e12
to
767f6ef
Compare
(and also database.wipe.before & database.wipe.after)
I need an install of windows to implement hooks in WSL. |
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!
if let Some(project) = &context.get_project().await? { | ||
hooks::on_action("branch.switch.before", project).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.
Would it be cleaner to have hooks::on_action
(or something similar) take a context
and then call it unconditionally in each call site, and have the logic there?
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.
We have a few different contextes: branching, migration, project. Some are subsets of other and contain different amounts of information.
hooks::on_action
takes project::Context
pro.arg(pair); | ||
} | ||
// TODO: set current dir | ||
pro.arg("/bin/sh"); |
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.
Make sure not to lose track of this
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.
Yes, this will be implemented when I do WSL for real.
[instance] | ||
server-version = "nightly" | ||
|
||
[project] | ||
schema-dir = "./database_schema" | ||
|
||
[hooks] | ||
project.init.before = "true" | ||
project.init.after = "true" | ||
branch.switch.before = "true" | ||
branch.switch.after = "true" | ||
branch.wipe.before = "true" | ||
branch.wipe.after = "true" | ||
migration.apply.before = "true" | ||
migration.apply.after = "true" |
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.
Probably we want some tests where we can test they ran in the right context?
Do we want
before
hooks too? I've implemented some because they were easy.