- Add comprehensive compatibility layer supporting both Procrastinate 2.x and 3.x - Implement version-aware database migration system with pre/post migrations for 3.x - Create worker option mapping for seamless transition between versions - Add extensive test coverage for all compatibility features - Update dependency constraints to support both 2.x and 3.x simultaneously - Provide Docker containerization with uv caching and multi-service orchestration - Include demo applications and web interface for testing capabilities - Bump version to 0.2.0 reflecting new compatibility features Key Features: - Automatic version detection and feature flagging - Unified connector creation across PostgreSQL drivers - Worker option translation (timeout → fetch_job_polling_interval) - Database migration utilities with CLI and programmatic interfaces - Complete Docker Compose setup with PostgreSQL, Redis, workers, and demos Files Added: - src/video_processor/tasks/compat.py - Core compatibility layer - src/video_processor/tasks/migration.py - Migration utilities - src/video_processor/tasks/worker_compatibility.py - Worker CLI - tests/test_procrastinate_compat.py - Compatibility tests - tests/test_procrastinate_migration.py - Migration tests - Dockerfile - Multi-stage build with uv caching - docker-compose.yml - Complete development environment - examples/docker_demo.py - Containerized demo application - examples/web_demo.py - Flask web interface demo Migration Support: - Procrastinate 2.x: Single migration command compatibility - Procrastinate 3.x: Separate pre/post migration phases - Database URL validation and connection testing - Version-specific feature detection and graceful degradation
42 lines
1.4 KiB
SQL
42 lines
1.4 KiB
SQL
-- Database initialization for Video Processor
|
|
-- Creates necessary databases and extensions
|
|
|
|
-- Create test database
|
|
CREATE DATABASE video_processor_test;
|
|
|
|
-- Connect to main database
|
|
\c video_processor;
|
|
|
|
-- Enable required extensions
|
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
|
|
-- Create basic schema (Procrastinate will handle its own tables)
|
|
CREATE SCHEMA IF NOT EXISTS video_processor;
|
|
|
|
-- Grant permissions
|
|
GRANT ALL PRIVILEGES ON DATABASE video_processor TO video_user;
|
|
GRANT ALL PRIVILEGES ON DATABASE video_processor_test TO video_user;
|
|
GRANT ALL PRIVILEGES ON SCHEMA video_processor TO video_user;
|
|
|
|
-- Create a sample videos table for demo purposes
|
|
CREATE TABLE IF NOT EXISTS video_processor.videos (
|
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
filename VARCHAR(255) NOT NULL,
|
|
original_path TEXT,
|
|
processed_path TEXT,
|
|
status VARCHAR(50) DEFAULT 'pending',
|
|
metadata JSONB,
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
|
|
);
|
|
|
|
-- Create index for efficient queries
|
|
CREATE INDEX IF NOT EXISTS idx_videos_status ON video_processor.videos(status);
|
|
CREATE INDEX IF NOT EXISTS idx_videos_created_at ON video_processor.videos(created_at);
|
|
|
|
-- Insert sample data
|
|
INSERT INTO video_processor.videos (filename, status) VALUES
|
|
('sample_video_1.mp4', 'pending'),
|
|
('sample_video_2.mp4', 'processing'),
|
|
('sample_video_3.mp4', 'completed')
|
|
ON CONFLICT DO NOTHING; |