Skip to content

Conversation

@brandur
Copy link
Contributor

@brandur brandur commented May 17, 2025

Here, add a --schema option to the river migrate-get command that
lets the caller inject a custom schema into the SQL generated by the
command. If the --schema command is not provided, we hide the
/* TEMPLATE: schema */ comments for cleanliness (previously, they were
returned, which wasn't harmful but added visual noise).

Since we're making changes anyway, add a test suite for migrate-get.
It should've been there before anyway and it will help protect against
regressions.

Only tangentially related, fix a small bug in the migration "flags" that
are output like -- River main migration 001 [up] in that when using
the default "main" line, the line was being accidentally omitted.

Also unrelated, but add missing docs for river migrate-list which have
apparently accidentally been a TODO for quite some time.

Fixes #902.

brandur added a commit that referenced this pull request May 17, 2025
…therwise

Here, add a `--schema` option to the `river migrate-get` command that
lets the caller inject a custom schema into the SQL generated by the
command. If the `--schema` command is not provided, we hide the `/*
TEMPLATE: schema */` comments for cleanliness (previously, they were
returned, which wasn't harmful but added visual noise).

Only tangentially related, fix a small bug in the migration "flags" that
are output like `-- River main migration 001 [up]` in that when using
the default "main" line, the line was being accidentally omitted.

Also unrelated, but add missing docs for `river migrate-list` which have
apparently accidentally been a TODO for quite some time.

Fixes #903.
@brandur brandur force-pushed the brandur-migrate-get-schema branch 2 times, most recently from a943d9e to be12a95 Compare May 17, 2025 05:10
@brandur brandur force-pushed the brandur-migrate-get-schema branch from be12a95 to 5d32433 Compare May 17, 2025 05:14
// Don't log if this is part of a standard shutdown.
if !errors.Is(context.Cause(ctx), startstop.ErrStop) {
p.Logger.ErrorContext(ctx, p.Name+": Error fetching queue settings", slog.String("err", err.Error()))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what happened here. My linter is suddenly picking these up, but it seems like it should've picked them up before. I left the changes in though because they look right and I'm sure the linter will want to put them in another PR if not this one.

@brandur
Copy link
Contributor Author

brandur commented May 17, 2025

@bgentry Seem okay?

@brandur brandur requested a review from bgentry May 17, 2025 05:17
@brandur brandur force-pushed the brandur-migrate-get-schema branch from 5d32433 to f62402b Compare May 17, 2025 05:19
…therwise

Here, add a `--schema` option to the `river migrate-get` command that
lets the caller inject a custom schema into the SQL generated by the
command. If the `--schema` command is not provided, we hide the `/*
TEMPLATE: schema */` comments for cleanliness (previously, they were
returned, which wasn't harmful but added visual noise).

Since we're making changes anyway, add a test suite for `migrate-get`.
It should've been there before anyway and it will help protect against
regressions.

Only tangentially related, fix a small bug in the migration "flags" that
are output like `-- River main migration 001 [up]` in that when using
the default "main" line, the line was being accidentally omitted.

Also unrelated, but add missing docs for `river migrate-list` which have
apparently accidentally been a TODO for quite some time.

Fixes #902.
@brandur brandur force-pushed the brandur-migrate-get-schema branch from f62402b to 821fcec Compare May 17, 2025 14:51
@brandur
Copy link
Contributor Author

brandur commented May 17, 2025

thx.

@brandur brandur merged commit f0d5b3d into master May 17, 2025
10 checks passed
@brandur brandur deleted the brandur-migrate-get-schema branch May 17, 2025 15:00
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.

SQL migrations don't do schema template substitution

3 participants