-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathses_notifications_init.sql
93 lines (90 loc) · 4.79 KB
/
ses_notifications_init.sql
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
CREATE SCHEMA ses_notifications AUTHORIZATION postgres;
CREATE TABLE ses_notifications.bounces (
id int8 NOT NULL GENERATED ALWAYS AS IDENTITY,
notification_id int8 NOT NULL,
notification_type varchar(32) NOT NULL,
sent_at timestamptz NOT NULL,
messageid varchar(128) NOT NULL,
"from" varchar(256) NOT NULL COLLATE "ucs_basic",
source_arn varchar(256) NULL,
source_ip varchar(32) NULL,
sending_account_id varchar(128) NULL,
bounce_type varchar(128) NOT NULL,
bounce_sub_type varchar(128) NOT NULL,
created_at timestamptz NULL,
feedback_id varchar(256) NULL,
reporting_mta varchar(256) NULL,
remote_mta_ip varchar(32) NULL,
bounced_recipients varchar(64000) NULL COLLATE "ucs_basic"
);
CREATE INDEX bounces_bounce_sub_type_idx ON ses_notifications.bounces USING btree (bounce_sub_type);
CREATE INDEX bounces_bounce_type_idx ON ses_notifications.bounces USING btree (bounce_type);
CREATE INDEX bounces_bounced_recipients_idx ON ses_notifications.bounces USING btree (bounced_recipients);
CREATE INDEX bounces_created_at_idx ON ses_notifications.bounces USING btree (created_at);
CREATE INDEX bounces_from_idx ON ses_notifications.bounces USING btree ("from");
CREATE UNIQUE INDEX bounces_id_idx ON ses_notifications.bounces USING btree (id);
CREATE INDEX bounces_messageid_idx ON ses_notifications.bounces USING btree (messageid);
CREATE INDEX bounces_notification_id_idx ON ses_notifications.bounces USING btree (notification_id);
CREATE INDEX bounces_sent_at_idx ON ses_notifications.bounces USING btree (sent_at);
CREATE TABLE ses_notifications.complaints (
id int8 NOT NULL GENERATED ALWAYS AS IDENTITY,
notification_id int8 NOT NULL,
notification_type varchar(32) NOT NULL,
sent_at timestamptz NOT NULL,
messageid varchar(128) NOT NULL,
"from" varchar(256) NOT NULL COLLATE "ucs_basic",
source_arn varchar(256) NULL,
source_ip varchar(32) NULL,
sending_account_id varchar(128) NULL,
created_at timestamptz NULL,
complaint_sub_type varchar(64) NULL COLLATE "ucs_basic",
complaint_feedback_type varchar(256) NULL COLLATE "ucs_basic",
feedback_id varchar(256) NULL,
complained_recipients varchar(64000) NULL COLLATE "ucs_basic",
user_agent varchar(1024) NULL,
arrival_date timestamptz NULL
);
CREATE INDEX complaints_complained_recipients_idx ON ses_notifications.complaints (complained_recipients);
CREATE INDEX complaints_complaint_feedback_type_idx ON ses_notifications.complaints (complaint_feedback_type);
CREATE INDEX complaints_complaint_sub_type_idx ON ses_notifications.complaints (complaint_sub_type);
CREATE INDEX complaints_created_at_idx ON ses_notifications.complaints (created_at);
CREATE INDEX complaints_from_idx ON ses_notifications.complaints ("from");
CREATE UNIQUE INDEX complaints_id_idx ON ses_notifications.complaints (id);
CREATE INDEX complaints_messageid_idx ON ses_notifications.complaints (messageid);
CREATE INDEX complaints_notification_id_idx ON ses_notifications.complaints (notification_id);
CREATE INDEX complaints_sent_at_idx ON ses_notifications.complaints (sent_at);
CREATE TABLE ses_notifications.deliveries (
id int8 NOT NULL GENERATED ALWAYS AS IDENTITY,
notification_id int8 NOT NULL,
notification_type varchar(32) NOT NULL,
sent_at timestamptz NOT NULL,
messageid varchar(128) NOT NULL,
"from" varchar(256) NOT NULL COLLATE "ucs_basic",
source_arn varchar(256) NULL,
source_ip varchar(32) NULL,
sending_account_id varchar(128) NULL,
delivered_at timestamptz NULL,
smtp_response varchar(256) NULL COLLATE "ucs_basic",
reporting_mta varchar(256) NULL,
remote_mta_ip varchar(32) NULL,
recipients varchar(64000) NULL COLLATE "ucs_basic"
);
CREATE INDEX deliveries_delivered_at_idx ON ses_notifications.deliveries (delivered_at);
CREATE INDEX deliveries_from_idx ON ses_notifications.deliveries ("from");
CREATE UNIQUE INDEX deliveries_id_idx ON ses_notifications.deliveries (id);
CREATE INDEX deliveries_messageid_idx ON ses_notifications.deliveries (messageid);
CREATE INDEX deliveries_notification_id_idx ON ses_notifications.deliveries (notification_id);
CREATE INDEX deliveries_recipients_idx ON ses_notifications.deliveries (recipients);
CREATE INDEX deliveries_sent_at_idx ON ses_notifications.deliveries (sent_at);
CREATE INDEX deliveries_smtp_response_idx ON ses_notifications.deliveries (smtp_response);
CREATE TABLE ses_notifications.notifications (
id int8 NOT NULL GENERATED ALWAYS AS IDENTITY,
notification varchar(64000) NOT NULL COLLATE "ucs_basic",
received_at timestamptz NOT NULL,
message_id varchar(128) NOT NULL,
sent_at timestamptz NOT NULL
);
CREATE UNIQUE INDEX notifications_id_idx ON ses_notifications.notifications (id);
CREATE INDEX notifications_message_id_idx ON ses_notifications.notifications (message_id);
CREATE INDEX notifications_received_at_idx ON ses_notifications.notifications (received_at);
CREATE INDEX notifications_sent_at_idx ON ses_notifications.notifications (sent_at);