diff --git a/lambda/init_db.py b/lambda/init_db.py index ea76352..9dcd8a1 100644 --- a/lambda/init_db.py +++ b/lambda/init_db.py @@ -55,6 +55,18 @@ def lambda_handler(event, context): file_path="init_status_db.sql" ) + # Execute the new video workflow initialization SQL against video_status + _execute_sql_file( + conn=psycopg2.connect( + host=db_host, + port=db_port, + database="video_status", + user=db_user, + password=db_password, + ), + file_path="init_video_workflow_db.sql" + ) + _execute_sql_file( conn=psycopg2.connect( host=db_host, diff --git a/outputs.tf b/outputs.tf index d9b22f1..1039abf 100644 --- a/outputs.tf +++ b/outputs.tf @@ -37,3 +37,8 @@ output "video_processor_ecr_repository_uri" { description = "URI of the Video Processor ECR public repository" value = aws_ecrpublic_repository.video_processor.repository_uri } + +output "ecr_public_alias" { + description = "Public ECR registry alias (used to form public.ecr.aws//...). Exposed so CI can use it as ECR_PUBLIC_ALIAS." + value = split("/", aws_ecrpublic_repository.video_processor.repository_uri)[1] +} diff --git a/scripts/init_video_workflow_db.sql b/scripts/init_video_workflow_db.sql new file mode 100644 index 0000000..4b39e4d --- /dev/null +++ b/scripts/init_video_workflow_db.sql @@ -0,0 +1,26 @@ +-- Cria a tabela de workflow de vídeos e índices associados +CREATE EXTENSION IF NOT EXISTS pgcrypto; + +CREATE TABLE IF NOT EXISTS tb_video_workflow ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + user_id VARCHAR(255) NOT NULL, + video_id VARCHAR(255) NOT NULL, + upload_path VARCHAR(500) NOT NULL, + output_path VARCHAR(500), + status VARCHAR(50) NOT NULL, + error_message VARCHAR(255), + uploaded_at TIMESTAMP, + processed_at TIMESTAMP, + last_updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + ); + +-- Índices importantes +CREATE INDEX IF NOT EXISTS idx_workflow_status + ON tb_video_workflow(status); + +CREATE INDEX IF NOT EXISTS idx_workflow_video_id + ON tb_video_workflow(video_id); + +CREATE INDEX IF NOT EXISTS idx_workflow_user_id + ON tb_video_workflow(user_id); +