Class: OpenWFE::Extras::WorkitemTables

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/openwfe/extras/participants/activeparticipants.rb

Overview

The migration for ActiveParticipant and associated classes.

There are two tables ‘workitems’ and ‘fields’. As its name implies, the latter table stores the fields (also called attributes in OpenWFE speak) of the workitems.

See Workitem and Field for more details.

For centralization purposes, the migration and the model are located in the same source file. It should be quite easy for the Rails hackers among you to sort that out for a Rails based usage.

Class Method Summary collapse

Class Method Details

.downObject



108
109
110
111
112
# File 'lib/openwfe/extras/participants/activeparticipants.rb', line 108

def self.down

    drop_table :workitems
    drop_table :fields
end

.upObject



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/openwfe/extras/participants/activeparticipants.rb', line 72

def self.up

    create_table :workitems do |t|
        t.column :fei, :string
        t.column :wfid, :string
        t.column :wf_name, :string
        t.column :wf_revision, :string
        t.column :participant_name, :string
        t.column :store_name, :string
        t.column :dispatch_time, :timestamp
        t.column :last_modified, :timestamp

        t.column :yattributes, :text
            # when using compact_workitems, attributes are stored here

    end
    add_index :workitems, :fei, :unique => true
    add_index :workitems, :wfid
    add_index :workitems, :wf_name
    add_index :workitems, :wf_revision
    add_index :workitems, :participant_name
    add_index :workitems, :store_name

    create_table :fields do |t|
        t.column :fkey, :string, :null => false
        t.column :vclass, :string, :null => false
        t.column :svalue, :string
        t.column :yvalue, :text
        t.column :workitem_id, :integer, :null => false
    end
    add_index :fields, [ :workitem_id, :fkey ], :unique => true
    add_index :fields, :fkey
    add_index :fields, :vclass
    add_index :fields, :svalue
end