Migration generator
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
Description:
|
||||
Explain the generator
|
||||
|
||||
Example:
|
||||
rails generate install Thing
|
||||
|
||||
This will create:
|
||||
what/will/it/create
|
||||
@@ -0,0 +1,20 @@
|
||||
require 'rails/generators'
|
||||
require 'rails/generators/migration'
|
||||
|
||||
module Burden
|
||||
module Generators
|
||||
class InstallGenerator < Rails::Generators::Base
|
||||
include Rails::Generators::Migration
|
||||
|
||||
source_root File.expand_path('../templates', __FILE__)
|
||||
|
||||
def self.next_migration_number(path)
|
||||
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
||||
end
|
||||
|
||||
def create_migration
|
||||
migration_template 'create_burden_runs.rb', 'db/migrate/create_burden_runs.rb'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
class CreateBurdenRuns < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :burden_runs do |t|
|
||||
t.string :name
|
||||
t.boolean :success
|
||||
t.float :execution_time
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :burden_runs
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user