-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathv03.ex
More file actions
51 lines (40 loc) · 1.47 KB
/
v03.ex
File metadata and controls
51 lines (40 loc) · 1.47 KB
1
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
47
48
49
50
51
defmodule ErrorTracker.Migration.MySQL.V03 do
@moduledoc false
use Ecto.Migration
def up(_opts) do
create table(:error_tracker_meta, primary_key: [name: :key, type: :string]) do
add :value, :string, null: false
end
create table(:error_tracker_errors, primary_key: [name: :id, type: :bigserial]) do
add :kind, :string, null: false
add :reason, :text, null: false
add :source_line, :text, null: false
add :source_function, :text, null: false
add :status, :string, null: false
add :fingerprint, :string, null: false
add :last_occurrence_at, :utc_datetime_usec, null: false
timestamps(type: :utc_datetime_usec)
end
create unique_index(:error_tracker_errors, [:fingerprint])
create table(:error_tracker_occurrences, primary_key: [name: :id, type: :bigserial]) do
add :context, :map, null: false
add :reason, :text, null: false
add :stacktrace, :map, null: false
add :error_id,
references(:error_tracker_errors,
on_delete: :delete_all,
column: :id,
type: :bigserial
),
null: false
timestamps(type: :utc_datetime_usec, updated_at: false)
end
create index(:error_tracker_occurrences, [:error_id])
create index(:error_tracker_errors, [:last_occurrence_at])
end
def down(_opts) do
drop table(:error_tracker_occurrences)
drop table(:error_tracker_errors)
drop table(:error_tracker_meta)
end
end