- Added PostgreSQL client installation to Dockerfile for database interactions. - Updated BackupScheduler to manage both backup jobs and email fetching jobs. - Implemented email fetching job with logging and error handling. - Enhanced the frontend to display scheduled jobs, including email fetch status. - Introduced email upload functionality with drag-and-drop support and progress tracking. - Added import_method tracking to email_messages for better source identification. - Updated email parsing logic for .eml and .msg files, including attachment handling. - Removed obsolete email scheduler service as functionality is integrated into BackupScheduler. - Updated requirements for extract-msg to the latest version. - Created migration script to add import_method column to email_messages table.
25 lines
900 B
SQL
25 lines
900 B
SQL
-- Migration: Add import_method tracking to email_messages
|
|
-- Purpose: Track how emails were imported (IMAP, Graph API, or manual upload)
|
|
-- Date: 2026-01-06
|
|
|
|
-- Add import_method column
|
|
ALTER TABLE email_messages
|
|
ADD COLUMN import_method VARCHAR(50) DEFAULT 'imap';
|
|
|
|
-- Add comment
|
|
COMMENT ON COLUMN email_messages.import_method IS 'How the email was imported: imap, graph_api, or manual_upload';
|
|
|
|
-- Create index for filtering by import method
|
|
CREATE INDEX idx_email_messages_import_method ON email_messages(import_method);
|
|
|
|
-- Update existing records to reflect their actual source
|
|
-- (all existing emails were fetched via IMAP or Graph API)
|
|
UPDATE email_messages
|
|
SET import_method = 'imap'
|
|
WHERE import_method IS NULL;
|
|
|
|
-- Add constraint to ensure valid values
|
|
ALTER TABLE email_messages
|
|
ADD CONSTRAINT chk_email_import_method
|
|
CHECK (import_method IN ('imap', 'graph_api', 'manual_upload'));
|