Skip to content

feat: add --forceActions option to current#255

Merged
benjie merged 5 commits into
mainfrom
watch-force-actions
Apr 22, 2026
Merged

feat: add --forceActions option to current#255
benjie merged 5 commits into
mainfrom
watch-force-actions

Conversation

@benjie
Copy link
Copy Markdown
Member

@benjie benjie commented Apr 22, 2026

Implements #148; work was primarily done by @maxkorp

Description

This adds the --forceActions flag to graphile-migrate current, which behaves as it does for the migrate command

Performance impact

If running graphile-migrate current this will run the actions as specified without any real performance hit (except for the time spent to run the actions, obviously), since it's just an additional or statement against a boolean.

Security impact

None that I can think of?

Checklist

  • My code matches the project's code style and yarn lint:fix passes.
  • I've added tests for the new feature, and yarn test passes.
  • I have detailed the new feature in the relevant documentation.
  • I have added this feature to 'Pending' in the RELEASE_NOTES.md file (if one exists).
  • If this is a breaking change I've explained why.

Comment thread src/currentRunner.ts
Comment on lines -77 to +88
// 4: if different
if (!migrationsAreEquivalent) {
// 3a: Run actions if the migrations are different OR if forced.
if (forceActions || !migrationsAreEquivalent) {
await executeActions(
parsedSettings,
shadow,
parsedSettings.beforeCurrent,
);
}

// 4: if different
if (!migrationsAreEquivalent) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@maxkorp This is different to your previous logic - the actions are now ran independently of the database changes themselves being implemented. Is this desired? I think it effectively makes little difference since we're in a transaction so the changes aren't visible anyway...

Comment thread src/currentRunner.ts
const interval = process.hrtime(start);
const duration = interval[0] * 1e3 + interval[1] * 1e-6;
if (!migrationsAreEquivalent) {
if (forceActions || !migrationsAreEquivalent) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@maxkorp unless I messed up all the merges, I think you omitted this change previously?

@benjie benjie changed the title feat: add --forceActions option to watch feat: add --forceActions option to current Apr 22, 2026
@benjie
Copy link
Copy Markdown
Member Author

benjie commented Apr 22, 2026

The thing this is lacking right now is tests. The code looks fine.

@benjie benjie merged commit 6ed5254 into main Apr 22, 2026
12 checks passed
@benjie
Copy link
Copy Markdown
Member Author

benjie commented Apr 22, 2026

Released in graphile-migrate@2.0.0-rc.3

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.

1 participant