- Introduced a new sync pipeline for IMAP that integrates a rules engine and webhook execution. - Enhanced the `SyncWorker` to support attachment management and folder synchronization. - Added functionality to detect special folder types (Sent, Drafts, Trash, Archive, Spam) during sync. - Implemented a database schema for tracking rule executions and their outcomes. - Created unit tests for the new rules engine and webhook execution logic. - Updated migration scripts to accommodate new database structures for rule executions and folder states. - Enhanced error handling and logging throughout the sync process for better observability.
15 lines
663 B
SQL
15 lines
663 B
SQL
ALTER TABLE mail_folders ADD COLUMN last_uid BIGINT NOT NULL DEFAULT 0;
|
|
|
|
CREATE TABLE rule_executions (
|
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
rule_id UUID NOT NULL REFERENCES mail_rules(id) ON DELETE CASCADE,
|
|
message_id UUID NOT NULL REFERENCES messages(id) ON DELETE CASCADE,
|
|
actions_applied JSONB NOT NULL DEFAULT '[]',
|
|
error TEXT NOT NULL DEFAULT '',
|
|
executed_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX idx_rule_executions_rule_id ON rule_executions(rule_id);
|
|
CREATE INDEX idx_rule_executions_message_id ON rule_executions(message_id);
|
|
CREATE INDEX idx_rule_executions_executed_at ON rule_executions(executed_at);
|