Class: RscratchSchemaMigration

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

Instance Method Summary collapse

Instance Method Details

#changeObject



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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/generators/rscratch/install/templates/migration.rb', line 2

def change
  # Exception table
  unless table_exists?("rscratch_exceptions")
    create_table :rscratch_exceptions do |t|
      t.text :exception
      t.text :message
      t.string :controller
      t.string :action
      t.string :app_environment
      t.integer :total_occurance_count
      t.integer :new_occurance_count
      t.string :status
      t.boolean :is_ignored, default: false

      t.timestamps
    end
  end

  # Exception log table
  unless table_exists?("rscratch_exception_logs")
    create_table :rscratch_exception_logs do |t|
      t.integer :exception_id
      t.text :description
      t.text :backtrace
      t.text :request_url
      t.string :request_method
      t.text :parameters
      t.string :user_agent
      t.string :client_ip
      t.string :status

      t.timestamps
    end 
  end 

  # Config table
  unless table_exists?("rscratch_configurations")
    create_table :rscratch_configurations do |tc|
      tc.string  :config_key
      tc.string  :config_value

      tc.timestamps
    end      
  end      
end