Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
rake_migrations_velocity
Advanced tools
This gem helps you and your team members keep track of which rake tasks are yet to be run on a particular system. The logic is similar to that of how rake db:migrate
is used.
For a more verbose explanation please refer to this blog post.
At the moment I have only tested this on Rails 5.X.X, 6.X.x and 7.X.X running postgresql on Mac OS X. If you can help by testing this on different versions, databases and platforms, let me know.
First, add this this to your gemfile:
gem 'rake_migrations', git: 'https://github.com/Velocity-Engineering/rake-migrations.git'
Then, run:
bundle install
rails g rake_migrations:install
# Don't forget to migrate
rake db:migrate
This will copy a db schema migration (rake_migrations
) file and a helper rake task (devops_rake_utils.rake
) in your lib/tasks/
directory
Finally, add the following file in your config/initializers
folder to provide the gem with database credentials via the database.yml
file
# rake_migrations.rb
RakeMigrations.configure do |config|
config.database_name = 'neobank'
config.hostname = ENV['DATABASE_HOST']
config.username = ENV['DATABASE_USERNAME']
config.password = ENV['DATABASE_PASSWORD']
end
Whenever somebody from your team wants to create a new run once task, simply generate it by running:
rails g task <namespace> <task>
For example:
rails g task migrations_test testing_the_gem
This will generate a file under lib/tasks/rake_migrations
with a timestamp and six random character prefixed filename and the following content:
#
# Checklist:
# 1. Re-runnable on production?
# 2. Is there a chance emails will be sent?
# 3. puts ids & logs (progress log)
# 4. Should this be inside a Active Record Transaction block?
# 5. Are there any callbacks?
# 6. Performance issues?
namespace :migrations_test do
desc "TODO"
task testing_the_gem: [:environment] do
# DO NOT REMOVE THIS PART. MARKS THE RAKE AS COMPLETE IN THE DATABASE
RakeMigration.mark_complete(__FILE__)
end
end
Simply insert your code above the "DO NOT REMOVE THIS PART" line. The checklist is there to help you and the person who is code-reviewing your code to think of problems that might occur from your rake task.
Afterwards, whenever we need to check whether pending rake tasks, we run the following helper rake task...
rake devops_rake_utils:list_pending_rake_tasks
... which will give the following output in case some tasks aren't mapped to the rake_migrations
database table
You need to run the following rakes:
------------------------------------
rake migrations_test:testing_the_gem
You can run the rake task normally:
rake migrations_test:testing_the_gem
In case all of the rake files have been mapped across the rake_migrations
table, you will receive the following message
All rake files are mapped in the DB! No untracked rake tasks are present!
Feel free to open issues, send suggestions and fork this repository.
This gem was developed by Eyal Eizenberg and enhanced by Mani Bhushan.
Thanks and Enjoy! :)
FAQs
Unknown package
We found that rake_migrations_velocity demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.