Class: ActivityDb::CreateDb

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/activityutils/schema.rb

Instance Method Summary collapse

Instance Method Details

#downObject

method up

Raises:

  • (ActiveRecord::IrreversibleMigration)


29
30
31
# File 'lib/activityutils/schema.rb', line 29

def down
  raise ActiveRecord::IrreversibleMigration
end

#upObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/activityutils/schema.rb', line 5

def up

create_table :activities do |t|
t.integer :user_id    # references user


t.integer :trackable_id
t.string  :trackable_type    # is polymorphic


t.string  :action    #  holds only create|update|delete - for trackable record


## optional free form (free text) activity -- make it into a table of its own? why? why not?

#  why - keeps render uniform

# why not - creates an extra record/model/table


t.text    :text      # optional - text to render

t.string  :tmpl      # optional - template key


### t.string  :params  - add parameters column - why ?? why not??


t.timestamps   # - only need created-at - supposed no changes e.g. no modified_at

end

end