Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use lease_connection over deprecated connection for rails 8 #353

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

vprigent
Copy link
Collaborator

Call register_task as extending DatabaseTasks doesn't hold onto that

Fixes #352

Call `register_task` as extending DatabaseTasks doesn't hold onto that
@vprigent
Copy link
Collaborator Author

vprigent commented Nov 25, 2024

This currently causes the rails db:prepare:with_data to run but silently fails to run the data migrations.

Weird is that rails db:drop db:prepare:with_data runs it fine...

@vprigent
Copy link
Collaborator Author

vprigent commented Dec 4, 2024

There seems to be erratic issues with sqlite when running rails db:drop && rails db:prepare:with_data that isn't quite just relevant to data-migrate. It looks like somehow rails db:drop happens but the db files remain behind, cause db:prepare:with_data to still find the data_migration versions.

rails db:drop db:prepare:with_data seems to not cause the issue.

@vprigent vprigent requested a review from Morozzzko December 4, 2024 08:01
@vprigent vprigent marked this pull request as ready for review December 4, 2024 08:01
@vprigent
Copy link
Collaborator Author

vprigent commented Dec 4, 2024

This worked fine with Rails 7.1 through to 8.0
Unfortunately lease_connection was only added recently and isn't available for older Rails versions.

Copy link
Collaborator

@Morozzzko Morozzzko left a comment

Choose a reason for hiding this comment

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

🎉

@Morozzzko
Copy link
Collaborator

There seems to be erratic issues with sqlite when running rails db:drop && rails db:prepare:with_data that isn't quite just relevant to data-migrate. It looks like somehow rails db:drop happens but the db files remain behind, cause db:prepare:with_data to still find the data_migration versions.

I've faced some issues when I was doing drop-create-migrate in the past, but with a larger RDBMS. Probably not the best chain of commands to execute ever. So I guess it's alright

@vprigent vprigent merged commit 9f8df61 into ilyakatz:main Dec 6, 2024
15 checks passed
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.

db:prepare:with_data not working in rails 8.0.0
2 participants