Sha256: d8106efa15af1ffc38f15c01c01a739ef78f9dad2d795410ce9702cc5214a928

Contents?: true

Size: 1.31 KB

Versions: 5

Compression:

Stored size: 1.31 KB

Contents

class Create<%= file_name.tableize.classify.pluralize %> < ActiveRecord::Migration
  def self.up
    create_table :<%= file_name.tableize %> do |t|
      
      # don't change these unless you want to get deep into meta in the
      # stonepath gem.
      t.string :aasm_state
      t.references :workitem, :polymorphic => true
      t.references :workbench, :polymorphic => true
      
      t.datetime :due_at
      t.datetime :completed_at
      t.timestamps
      
      # This "urgent at' concept was useful in one of the domains StonePath
      # was written/extracted from.  The idea is that while something is 'due'
      # at a specific time, it might become urgent shortly before it is due.
      # In that domain, we color-coded tasks as green (due date is far out)
      # yellow (urgent timestap has passed), and red (overdue - due date  
      # has passed).  This won't become part of the framework, but I like the
      # idea so much I thought I'd comment it here until it gets in some
      # official documentation for 'advanced usage'.
      # t.datetime :urgent_at
      
      # Your attributes should be defined here.
    <%- for attribute in attributes -%>
      t.<%= attribute.type %> :<%= attribute.name %>
    <%- end -%>

    end
  end

  def self.down    
    drop_table :<%= file_name.tableize %>
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stonepath-0.6.3 lib/generators/stonepath/task/templates/migration.rb
stonepath-0.6.2 lib/generators/stonepath/task/templates/migration.rb
stonepath-0.6.1 lib/generators/stonepath/task/templates/migration.rb
stonepath-0.6.0 lib/generators/stonepath/task/templates/migration.rb
stonepath-0.5.0 lib/generators/stonepath/task/templates/migration.rb