Class: CreateRiparian

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/templates/migration.rb

Class Method Summary collapse

Class Method Details

.downObject



34
35
36
37
# File 'lib/generators/templates/migration.rb', line 34

def self.down
  drop_table :flow_tasks
  drop_table :flow_task_resources
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/generators/templates/migration.rb', line 2

def self.up
  create_table :flow_tasks do |t|
    t.string :type
    t.string :options
    t.string :command
    t.string :error_msg
    t.datetime :started_at
    t.datetime :finished_at
    t.datetime :deleted_at
    t.integer :user_id
    t.string :redirect_url
    t.timestamps
  end
  add_index :flow_tasks, :user_id
  
  create_table :flow_task_resources do |t|
    t.integer :flow_task_id
    t.string :resource_type
    t.integer :resource_id
    t.string :type
    t.string :file_file_name
    t.string :file_content_type
    t.integer :file_file_size
    t.datetime :file_updated_at
    t.string :extra
    t.timestamps
  end
  add_index :flow_task_resources, [:flow_task_id, :type]
  add_index :flow_task_resources, [:resource_type, :resource_id]
  
end