Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Commit

Permalink
added the migration generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Kreeftmeijer committed Jan 16, 2010
1 parent d8b075e commit e683675
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
15 changes: 15 additions & 0 deletions generators/navvy/navvy_generator.rb
@@ -0,0 +1,15 @@
class NavvyGenerator < Rails::Generator::Base
def manifest
record do |m|
options = {
:migration_file_name => 'create_jobs'
}

m.migration_template 'migration.rb', 'db/migrate', options
end
end

def banner
"Usage: #{$0} #{spec.name}"
end
end
20 changes: 20 additions & 0 deletions generators/navvy/templates/migration.rb
@@ -0,0 +1,20 @@
class CreateDelayedJobs < ActiveRecord::Migration
def self.up
create_table :jobs, :force => true do |t|
table.string :object
table.string :method
table.text :arguments
table.string :return
table.string :exception
table.time :created_at
table.time :run_at
table.time :started_at
table.time :completed_at
table.time :failed_at
end
end

def self.down
drop_table :jobs
end
end
2 changes: 2 additions & 0 deletions navvy.gemspec
Expand Up @@ -23,6 +23,8 @@ Gem::Specification.new do |s|
"README.textile",
"Rakefile",
"VERSION",
"generators/navvy/navvy_generator.rb",
"generators/navvy/templates/migration.rb",
"lib/navvy.rb",
"lib/navvy/job/active_record.rb",
"lib/navvy/job/mongo_mapper.rb",
Expand Down

0 comments on commit e683675

Please sign in to comment.