Add hash to Subject
The hash gives us a new column in our table, which we can use to query a specific combination of args and key more efficient [MAILPOET-4966]
This commit is contained in:
@ -39,10 +39,10 @@ class AutomationRunStorage {
|
||||
return $automationRunId;
|
||||
}
|
||||
|
||||
$sql = 'insert into ' . esc_sql($this->subjectTable) . ' (`automation_run_id`, `key`, `args`) values %s';
|
||||
$sql = 'insert into ' . esc_sql($this->subjectTable) . ' (`automation_run_id`, `key`, `args`, `hash`) values %s';
|
||||
$values = [];
|
||||
foreach ($subjectTableData as $entry) {
|
||||
$values[] = (string)$this->wpdb->prepare("(%d,%s,%s)", $automationRunId, $entry['key'], $entry['args']);
|
||||
$values[] = (string)$this->wpdb->prepare("(%d,%s,%s,%s)", $automationRunId, $entry['key'], $entry['args'], $entry['hash']);
|
||||
}
|
||||
$sql = sprintf($sql, implode(',', $values));
|
||||
$result = $this->wpdb->query($sql);
|
||||
|
Reference in New Issue
Block a user