ActiveRecord storage draft
This commit is contained in:
parent
639c542aaf
commit
3fc9fba18c
|
@ -0,0 +1,14 @@
|
|||
class CreateRakeControlRuns < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :rake_control_runs do |t|
|
||||
t.string :name
|
||||
t.boolean :success
|
||||
t.float :execution_time
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :rake_control_runs
|
||||
end
|
||||
end
|
|
@ -0,0 +1,22 @@
|
|||
require 'rails/generators'
|
||||
require 'rails/generators/migration'
|
||||
|
||||
class RakeControlGenerator < Rails::Generators::Base
|
||||
include Rails::Generators::Migration
|
||||
|
||||
def self.source_root
|
||||
@source_root ||= File.dirname(__FILE__)
|
||||
end
|
||||
|
||||
def self.next_migration_number(dirname)
|
||||
if ActiveRecord::Base.timestamped_migrations
|
||||
Time.new.utc.strftime('%Y%m%d%H%M%S')
|
||||
else
|
||||
'%.3d' % (current_migration_number(dirname) + 1)
|
||||
end
|
||||
end
|
||||
|
||||
def create_migration_file
|
||||
migration_template 'create_rake_control_runs.rb', 'db/migrate/create_rake_control_runs.rb'
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
module RakeControl
|
||||
class Run < ActiveRecord::Base
|
||||
attr_accessible :name, :success, :execution_time
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue