Skip to content

Add spaces between functions and triggers in schema.rb#195

Merged
teoljungberg merged 7 commits intoteoljungberg:masterfrom
chiperific:schema-dumper-spaces
Jan 31, 2026
Merged

Add spaces between functions and triggers in schema.rb#195
teoljungberg merged 7 commits intoteoljungberg:masterfrom
chiperific:schema-dumper-spaces

Conversation

@chiperific
Copy link
Contributor

I've been dealing with the changes to schema_dumper in Rails 8.1 and Senic 1.9 and found that it's most common for their methods not to emit a newline after their last operation.

Hence I think it's safe to assume that functions() and triggers() should emit a newline before their loops and within their loops, up to the last iteration.
And, not having these functions emit a final newline holds with the pattern used by the Rails and Scenic schema_dumpers.

I've tested this in my own apps with a patch on this gem and the spacing is correct with the new Rails 8.1 schema changes (and with Scenic emitting create_view statements before the create_function and create_trigger statements).

I've been dealing with the changes to schema_dumper in Rails 8.1 and
Senic 1.9 and found that it's most common for their methods not to emit
a newline after their last operation.

Hence I think it's safe to assume that functions() and triggers() should
emit a newline before their loops and within their loops, up to the last
iteration.
And, not having these functions emit a final newline holds with the pattern
used by the Rails and Scenic schema_dumpers.

I've tested this in my own apps with a patch on this gem and the spacing
is correct with the new Rails 8.1 schema changes (and with Scenic
emitting `create_view` statements before the `create_function` and
`create_trigger` statements).
@chiperific
Copy link
Contributor Author

@teoljungberg, any opposition?

@chiperific
Copy link
Contributor Author

@teoljungberg, just nudging.

@teoljungberg
Copy link
Owner

I don't quote understand this patch, what it aims to solve, without a test or similar showcasing why.

Copy link
Owner

@teoljungberg teoljungberg left a comment

Choose a reason for hiding this comment

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

Please come with tests, a diff file we can review, but something to showcase the behavior

@chiperific
Copy link
Contributor Author

I don't quote understand this patch, what it aims to solve, without a test or similar showcasing why.

Thanks for the review. I'll add a test to show where spaces are being emitted.

@chiperific
Copy link
Contributor Author

@teoljungberg, made those changes, ready for another review.

@chiperific
Copy link
Contributor Author

@teoljungberg nudge

@teoljungberg teoljungberg merged commit 0c817fd into teoljungberg:master Jan 31, 2026
4 checks passed
@teoljungberg
Copy link
Owner

Thank you @chiperific !

@teoljungberg
Copy link
Owner

I added an extra test to document when there is nothing to dump as b0b9c3f

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.

2 participants