[WIP] Update schema approach for schedule enable/disable support#8
Closed
Copilot wants to merge 1 commit into
Closed
[WIP] Update schema approach for schedule enable/disable support#8Copilot wants to merge 1 commit into
Copilot wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original prompt
Update pull request #7 in
DirectoryTree/Cadenceby changing the schema approach for schedule enable/disable support.Context:
disabled_attimestamp.database/migrations/create_schedules_table.php.stubto add thedisabled_atcolumn directly.Task:
DirectoryTree/Cadence.database/migrations/create_schedules_table.php.stubwith an additive migration strategy.disabled_attimestamp column to theschedulestable.down().Constraints:
Success criteria:
disabled_at.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Thoughts on this PR? Worth implementing in this package?
Assistant: Yes — this looks worth implementing, and the approach in the PR is sensible for this package.
Quick take
I’d rate it as a good fit with low-to-medium risk:
disabled_attimestamp, model helpers, query scopes, and runner filtering.next_run_at, enabling recomputes it from “now.”Why it fits this package
For a package like Cadence, “enabled/disabled” is a natural lifecycle state for schedules. Using
disabled_atinstead of a boolean is a nice choice because it:enabled(),disabled()).The runner change is also correct in spirit: only enabled schedules should be considered when dispatching due work.
What I like in the PR
disabled_atadded to the schedules table.disable(),enable(),isDisabled(),isEnabled().enabled()/disabled()scopes on the builder.disabled_atnext_run_atdisabled_atnext_run_atfrom the current timeschedules:run.My main caution
The only thing I’d want to think about before merging is schema/backward compatibility.
This PR updates the package’s migration stub to include
disabled_at, which is fine for new installs, but existing users who already published or ran the old migration won’t get this column automatically. So if this package supports upgrades in-place, you’ll probably need one of these:disabled_at, orThat’s not a reason to reject the feature — just something to handle explicitly.
Minor review notes
These are not blockers, just things to consider:
enable()recomputes from now, not from the previously missed cadence.I think that’s the right default, but it should be documented because some users may expect “resume where it left off.”
disable()andenable()always save immediately.That’s probably fine and convenient, but if the package tends to keep model methods side-effect light, it’s worth checking consistency.
next_run_at, but still good.It makes intent explicit and protects against inconsistent data.
Merge readiness
From what I can see:
Recommendation
I’d lean yes: merge it, assuming you’re comfo...
This pull request was created from Copilot chat.