Skip to content

Commit

Permalink
generator for adding date field to entries
Browse files Browse the repository at this point in the history
  • Loading branch information
mbulat committed Jul 24, 2015
1 parent b02c140 commit 506dabf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/generators/plutus/add_date_upgrade_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'rails/generators'
require 'rails/generators/migration'
require_relative 'base_generator'

module Plutus
class AddDateUpgradeGenerator < BaseGenerator
def create_migration_file
migration_template 'add_date_migration.rb', 'db/migrate/add_date_to_plutus_entries.rb'
end
end
end
6 changes: 6 additions & 0 deletions lib/generators/plutus/templates/add_date_migration.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddDateToPlutusEntries < ActiveRecord::Migration
def change
add_column :plutus_entries, :date, :date
add_index :plutus_entries, :date
end
end

0 comments on commit 506dabf

Please sign in to comment.