blog-backup/supabase/migrations/20250225_add_audio_columns.sql
OpenClaw Bot 3a81f88bfc Add MP3 audio hosting feature with Supabase Storage integration
- Create /api/audio endpoint for upload/get/delete operations
- Add AudioPlayer component with custom controls
- Add AudioUpload component for admin interface
- Update admin page with audio upload UI and indicators
- Update main blog page to use new AudioPlayer component
- Add database migration for audio_url and audio_duration columns
- Add comprehensive documentation in docs/MP3_AUDIO_FEATURE.md
- Update README with audio feature overview
2026-02-25 17:12:26 -06:00

24 lines
1.0 KiB
SQL

-- Database Schema Update for MP3 Audio Support
-- This migration adds audio columns to the blog_messages table
-- Add audio_url column (nullable text field for storing the public URL)
ALTER TABLE blog_messages
ADD COLUMN IF NOT EXISTS audio_url TEXT;
-- Add audio_duration column (nullable integer for duration in seconds)
ALTER TABLE blog_messages
ADD COLUMN IF NOT EXISTS audio_duration INTEGER;
-- Create index for faster queries on posts with audio
CREATE INDEX IF NOT EXISTS idx_blog_messages_audio
ON blog_messages(audio_url)
WHERE audio_url IS NOT NULL;
-- Storage bucket configuration (run in Supabase Dashboard SQL Editor)
-- Note: Bucket is created programmatically via the API
-- RLS Policy for audio files (if needed in future)
-- For now, audio files are publicly readable via the podcast-audio bucket
COMMENT ON COLUMN blog_messages.audio_url IS 'Public URL to the audio file in Supabase Storage';
COMMENT ON COLUMN blog_messages.audio_duration IS 'Audio duration in seconds (estimated from file size)';