Repository navigation
Expand file tree
/
Copy pathext_tables.sql
More file actions
148 lines (143 loc) · 7.21 KB
/
Copy pathext_tables.sql
File metadata and controls
148 lines (143 loc) · 7.21 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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
CREATE TABLE sys_refindex (
# EXT:form BE module related DatabaseService needs this index for "form usage count" lookups
# @todo: Solve differently somehow. It is essentially needed because not all form.yaml
# are FAL resources, but can be provided by extensions, too. See the registered
# softref parser for more details, too.
KEY lookup_string (ref_string(191)),
# Prevent full table scan for queries like "WHERE softref_key='formPersistenceIdentifier' and ref_uid > 0"
KEY idx_softref_key (softref_key,ref_uid)
);
#
# WapplerSystems fork: validation-failure logging table (opt-in per form).
# Used by the RecordValidationFailures listener to record one row per
# validation error so editors can analyze drop-off and friction points.
# Contains NO submitted user values — only form/element identifiers,
# error codes, the (already translated) error message, and an HMAC of
# the FormSession identifier for cross-submission aggregation.
#
#
# WapplerSystems fork: column for the CleanupValidationLogTask scheduler task
# (configured via TCA in Configuration/TCA/Overrides/scheduler_form_cleanup_validation_log_task.php).
# Only one column is needed; further task settings reuse standard scheduler fields.
#
CREATE TABLE tx_scheduler_task (
tx_form_retention_days SMALLINT(5) UNSIGNED DEFAULT 90 NOT NULL
);
CREATE TABLE tx_form_validation_log (
uid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
crdate INT(11) UNSIGNED DEFAULT 0 NOT NULL,
form_identifier VARCHAR(100) DEFAULT '' NOT NULL,
page_uid INT(11) UNSIGNED DEFAULT 0 NOT NULL,
language_uid INT(11) DEFAULT 0 NOT NULL,
element_identifier VARCHAR(100) DEFAULT '' NOT NULL,
property_path VARCHAR(200) DEFAULT '' NOT NULL,
error_code BIGINT(20) UNSIGNED DEFAULT 0 NOT NULL,
error_message VARCHAR(500) DEFAULT '' NOT NULL,
page_index SMALLINT(5) UNSIGNED DEFAULT 0 NOT NULL,
session_hash VARCHAR(64) DEFAULT '' NOT NULL,
PRIMARY KEY (uid),
KEY idx_form (form_identifier,crdate),
KEY idx_session (session_hash),
KEY idx_crdate (crdate)
);
#
# WapplerSystems fork: outgoing-mail log (see Classes/EventListener/RecordMailDeliveries.php).
# One row per notification mail an Email finisher tries to send, so the question
# "did the inquiry actually go out?" has an answer at all.
#
# The row is opened BEFORE the finisher runs and closed when its outcome is known,
# which is what makes a configuration error (missing senderAddress — thrown before
# any mail-specific event exists) and a hard abort (OOM, timeout, SIGKILL) visible
# instead of silently absent.
#
# Privacy: the recipient/subject/sender columns are only filled for forms that opted
# in, and `recipient_mode` records which policy produced `recipients` so old rows stay
# interpretable after a policy change. NEVER stored: message body, submitted form
# values, CC/BCC, attachment filenames, IP, user agent.
#
CREATE TABLE tx_form_mail_log (
uid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
crdate INT(11) UNSIGNED DEFAULT 0 NOT NULL,
tstamp INT(11) UNSIGNED DEFAULT 0 NOT NULL,
status TINYINT(3) UNSIGNED DEFAULT 0 NOT NULL,
submission_id VARCHAR(32) DEFAULT '' NOT NULL,
form_identifier VARCHAR(100) DEFAULT '' NOT NULL,
finisher_identifier VARCHAR(100) DEFAULT '' NOT NULL,
finisher_class VARCHAR(190) DEFAULT '' NOT NULL,
site_identifier VARCHAR(100) DEFAULT '' NOT NULL,
page_uid INT(11) UNSIGNED DEFAULT 0 NOT NULL,
language_uid INT(11) DEFAULT 0 NOT NULL,
recipient_mode VARCHAR(10) DEFAULT '' NOT NULL,
recipients VARCHAR(255) DEFAULT '' NOT NULL,
recipient_count SMALLINT(5) UNSIGNED DEFAULT 0 NOT NULL,
subject VARCHAR(255) DEFAULT '' NOT NULL,
sender VARCHAR(255) DEFAULT '' NOT NULL,
reply_to VARCHAR(255) DEFAULT '' NOT NULL,
attachment_count SMALLINT(5) UNSIGNED DEFAULT 0 NOT NULL,
transport VARCHAR(50) DEFAULT '' NOT NULL,
message_id VARCHAR(190) DEFAULT '' NOT NULL,
error_code BIGINT(20) UNSIGNED DEFAULT 0 NOT NULL,
error_class VARCHAR(190) DEFAULT '' NOT NULL,
error_message VARCHAR(500) DEFAULT '' NOT NULL,
PRIMARY KEY (uid),
KEY idx_crdate (crdate),
KEY idx_form (form_identifier,crdate),
KEY idx_status (status,crdate),
KEY idx_submission (submission_id)
);
#
# WapplerSystems fork: consent log (see Classes/EventListener/RecordConsents.php).
# One row per consent checkbox per submission.
#
# Art. 7(1) GDPR asks the controller to be able to demonstrate that the data
# subject consented. For a form whose only finisher is an Email one, the
# notification mail is the sole trace of a submission — a mailbox is not an
# evidence store, and it cannot say WHICH wording was shown. This table can:
# `text_hash` points at tx_form_consent_text, so a later edit of the consent
# text does not rewrite what past visitors agreed to.
#
# `subject` holds one identifying value from the submission (usually the e-mail
# address) so a record can be produced for a named person. It is the only
# personal datum here, it is only filled when the form names a subject field,
# and CleanupConsentLogTask prunes it — see the task for why its default
# retention is years rather than the 90 days of the mail log.
#
CREATE TABLE tx_form_consent_log (
uid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
crdate INT(11) UNSIGNED DEFAULT 0 NOT NULL,
submission_id VARCHAR(32) DEFAULT '' NOT NULL,
form_identifier VARCHAR(100) DEFAULT '' NOT NULL,
element_identifier VARCHAR(100) DEFAULT '' NOT NULL,
consent_key VARCHAR(100) DEFAULT '' NOT NULL,
given TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL,
text_hash VARCHAR(64) DEFAULT '' NOT NULL,
subject VARCHAR(255) DEFAULT '' NOT NULL,
subject_field VARCHAR(100) DEFAULT '' NOT NULL,
site_identifier VARCHAR(100) DEFAULT '' NOT NULL,
page_uid INT(11) UNSIGNED DEFAULT 0 NOT NULL,
language_uid INT(11) DEFAULT 0 NOT NULL,
PRIMARY KEY (uid),
KEY idx_form (form_identifier,crdate),
KEY idx_submission (submission_id),
KEY idx_subject (subject(100)),
KEY idx_crdate (crdate)
);
#
# WapplerSystems fork: the distinct consent wordings ever shown, addressed by
# the SHA-256 of the text. Normalised out of tx_form_consent_log because the
# same paragraph repeats on every single submission, and because "which
# versions have we ever used" then becomes one query instead of a GROUP BY over
# the whole log.
#
# Rows are written once and never updated; `last_seen` only moves forward.
#
CREATE TABLE tx_form_consent_text (
uid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
crdate INT(11) UNSIGNED DEFAULT 0 NOT NULL,
last_seen INT(11) UNSIGNED DEFAULT 0 NOT NULL,
text_hash VARCHAR(64) DEFAULT '' NOT NULL,
language_uid INT(11) DEFAULT 0 NOT NULL,
consent_text TEXT,
PRIMARY KEY (uid),
UNIQUE KEY uniq_hash (text_hash)
);