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
|
# File 'lib/generators/pg_insights/templates/db/migrate/create_pg_insights_query_executions.rb', line 2
def change
create_table :pg_insights_query_executions do |t|
t.references :query, null: true, foreign_key: { to_table: :pg_insights_queries }
t.text :sql_text, null: false
t.string :execution_type, null: false, default: "execute"
t.string :status, null: false, default: "pending"
t.json :result_data, null: true
t.integer :result_rows_count, null: true
t.integer :result_columns_count, null: true
t.json :execution_plan, null: true
t.text :plan_summary, null: true
t.decimal :planning_time_ms, precision: 10, scale: 3, null: true
t.decimal :execution_time_ms, precision: 10, scale: 3, null: true
t.decimal :total_time_ms, precision: 10, scale: 3, null: true
t.decimal :query_cost, precision: 15, scale: 3, null: true
t.json :performance_insights, null: true
t.json :execution_stats, null: true
t.text :error_message, null: true
t.text :error_detail, null: true
t.timestamp :started_at, null: true
t.timestamp :completed_at, null: true
t.decimal :duration_ms, precision: 10, scale: 3, null: true
t.timestamps
end
add_index :pg_insights_query_executions, :execution_type
add_index :pg_insights_query_executions, :status
add_index :pg_insights_query_executions, :created_at
add_index :pg_insights_query_executions, [ :query_id, :created_at ]
end
|