Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Improve data integrity of database table #52

Merged
merged 1 commit into from

5 participants

@croaky
  • Add :null => false constraint to priority, attempts, and handler.
  • Re-align comments in a column.
@croaky croaky Improve data integrity of database table
* Add `:null => false` constraint to `priority`, `attempts`, and
  `handler`.
* Re-align comments in a column.
cdb9cae
@croaky croaky referenced this pull request in thoughtbot/suspenders
Closed

Add Delayed::Job #166

@sferik
Owner

Looks good. Thanks Dan.

@sferik sferik merged commit ebd0244 into from
@coveralls

Coverage remained the same when pulling cdb9cae on croaky:dc-improve-data-integrity into f80fff6 on collectiveidea:master.

View Details

@albus522
Owner

We need to add an upgrade migration as well.

@sferik
Owner

@albus522 Good call.

@croaky Can you work on this?

@croaky

Yup, I can work on it.

To clarify, what kind of update migration? Add to the existing one documented as "Upgrading from 2.x to 3.0.0" (lib/generators/delayed_job/templates/update_migration.rb)? Or did you have something else in mind?

@javierjulio

@croaky did you end up starting on the upgrade migration? I'd like to pitch in and looks easy enough to do. Let me know and I'll contribute that change. I'd like to offer an enhancement with that as well as I noticed we have to duplicate the create_table definition, once in the migration and then another in our test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 8, 2013
  1. @croaky

    Improve data integrity of database table

    croaky authored
    * Add `:null => false` constraint to `priority`, `attempts`, and
      `handler`.
    * Re-align comments in a column.
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 9 deletions.
  1. +9 −9 lib/generators/delayed_job/templates/migration.rb
View
18 lib/generators/delayed_job/templates/migration.rb
@@ -1,15 +1,15 @@
class CreateDelayedJobs < ActiveRecord::Migration
def self.up
create_table :delayed_jobs, :force => true do |table|
- table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
- table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually.
- table.text :handler # YAML-encoded string of the object that will do work
- table.text :last_error # reason for last failure (See Note below)
- table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
- table.datetime :locked_at # Set when a client is working on this object
- table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
- table.string :locked_by # Who is working on this object (if locked)
- table.string :queue # The name of the queue this job is in
+ table.integer :priority, :default => 0, :null => false # Allows some jobs to jump to the front of the queue
+ table.integer :attempts, :default => 0, :null => false # Provides for retries, but still fail eventually.
+ table.text :handler, :null => false # YAML-encoded string of the object that will do work
+ table.text :last_error # reason for last failure (See Note below)
+ table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
+ table.datetime :locked_at # Set when a client is working on this object
+ table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
+ table.string :locked_by # Who is working on this object (if locked)
+ table.string :queue # The name of the queue this job is in
table.timestamps
end
Something went wrong with that request. Please try again.