diff --git a/bin/pd2pg b/bin/pd2pg index 4d06843..fb6ef8c 100755 --- a/bin/pd2pg +++ b/bin/pd2pg @@ -64,12 +64,13 @@ class PG2PD # Send all service records from Pagerduty to database. def services_to_db(items) - columns = [:id, :name, :status, :type] + columns = [:id, :name, :status, :type, :escalation_id] records = items.map do |i| [i['id'], i['name'], i['status'], - i['type']] + i['type'], + i['escalation_policy']['id']] end database_replace(:services, columns, records) end diff --git a/schema.sql b/schema.sql index a2d62fe..7cbaf7c 100644 --- a/schema.sql +++ b/schema.sql @@ -28,7 +28,8 @@ create table services ( id varchar primary key, name varchar not null, status varchar not null, - type varchar not null + type varchar not null, + escalation_id varchar ); create table escalation_policies (