Skip to content

Fix initialization crash when no DB connection#177

Merged
ka8725 merged 6 commits intomainfrom
issue-176-fix-without-conn-pool
Feb 5, 2026
Merged

Fix initialization crash when no DB connection#177
ka8725 merged 6 commits intomainfrom
issue-176-fix-without-conn-pool

Conversation

@NeverovDS
Copy link
Collaborator

@NeverovDS NeverovDS commented Feb 4, 2026

Closes #176

before do
utils.define_migration_file("20241218064344_ts360.rb", <<~RUBY)
class Ts360 < ActiveRecord::Migration[6.0]
class TS360 < ActiveRecord::Migration[6.0]
Copy link
Member

@ka8725 ka8725 Feb 4, 2026

Choose a reason for hiding this comment

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

@NeverovDS please see the reason this test has been added and what it tests - #108

end
end

# rubocop:disable Metrics/BlockLength
Copy link
Member

Choose a reason for hiding this comment

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

Instead of disabling this cop, can we come up with some other solution? E.g. create an internal class that us called within this block?

end

after do
utils.reset_acronyms
Copy link
Member

Choose a reason for hiding this comment

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

@NeverovDS if we do that within the utils.cleanup method, would it work?

Copy link
Member

@ka8725 ka8725 Feb 5, 2026

Choose a reason for hiding this comment

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

Or maybe remove this after block? Is it needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As I know, cleanup does a lot of unnecessary things: removes migrations, cleans the schema, reloads rake-tasks, deletes tmp/migrated

Copy link
Member

@ka8725 ka8725 Feb 5, 2026

Choose a reason for hiding this comment

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

@NeverovDS as I see the point of cleanup is to prepare a clean env for tests. It's currently executed everywhere in before block. Sounds like a good place for cleaning acronyms too. Why not? Otherwise, please elaborate on why all these things in cleanup are unnecessary.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ka8725 Sorry, I misunderstood you a little, you're right

@ka8725 ka8725 merged commit 029e8fc into main Feb 5, 2026
8 checks passed
@ka8725 ka8725 deleted the issue-176-fix-without-conn-pool branch February 5, 2026 10:26
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.

Version 0.9.0 accesses database connection during initialization even when migrations_storage is :file

2 participants