This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateDelayedJobGroups < ActiveRecord::Migration | |
def up | |
add_column(:delayed_jobs, :blocked, :boolean, default: false, null: false) | |
add_column(:delayed_jobs, :job_group_id, :integer) | |
add_index(:delayed_jobs, :job_group_id) | |
remove_index(:delayed_jobs, name: :delayed_jobs_priority) | |
execute <<-SQL | |
CREATE INDEX delayed_jobs_priority |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.jobs = ActiveSupport::OrderedOptions.new | |
# Controls whether or not workers report heartbeats | |
config.jobs.heartbeat_enabled = true | |
# How often workers should send heartbeats | |
config.jobs.heartbeat_interval_seconds = 60 | |
# How long a worker can go without sending a heartbeat before they're considered dead | |
config.jobs.heartbeat_timeout_seconds = 3 * 60 | |
# How often to check for dead workers | |
config.jobs.dead_worker_polling_interval_seconds = 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE VIEW product_stats AS | |
SELECT organization_id, | |
SUM(CASE WHEN status = 'active' THEN 1 END) active_count, | |
SUM(CASE WHEN status = 'inactive' THEN 1 END) inactive_count | |
FROM products | |
GROUP BY organization_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group :test do | |
gem 'atomic' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> blogs = Blogs.limit(5).to_a | |
# SELECT * FROM blogs LIMIT 5 | |
> blogs.each { |blog| blog.posts.to_a } | |
# SELECT * FROM posts WHERE blog_id IN (1,2,3,4,5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'arel', github: 'rails/arel' | |
gem 'sqlite3' | |
GEMFILE | |
system 'bundle' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'arel', github: 'rails/arel' | |
gem 'sqlite3' | |
GEMFILE | |
system 'bundle' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'arel', github: 'rails/arel' | |
gem 'sqlite3' | |
GEMFILE | |
system 'bundle' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'arel', github: 'rails/arel' | |
gem 'sqlite3' | |
GEMFILE | |
system 'bundle' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', '4.1.7' # Works with '4.0.11' | |
gem 'closure_tree' | |
gem 'sqlite3' | |
GEMFILE | |
system 'bundle' | |
end |
OlderNewer