-- migrations/006_drop_articles_table.sql
-- Rename 'articles' table to 'blog_posts'
-- This aligns with the Drizzle schema naming

-- Rename the table
ALTER TABLE IF EXISTS articles RENAME TO blog_posts;

-- Rename all indexes to match new table name
ALTER INDEX IF EXISTS idx_articles_slug RENAME TO idx_blog_posts_slug;
ALTER INDEX IF EXISTS idx_articles_external_id RENAME TO idx_blog_posts_external_id;
ALTER INDEX IF EXISTS idx_articles_category RENAME TO idx_blog_posts_category;
ALTER INDEX IF EXISTS idx_articles_publication_date RENAME TO idx_blog_posts_publication_date;
ALTER INDEX IF EXISTS idx_articles_featured RENAME TO idx_blog_posts_featured;
ALTER INDEX IF EXISTS idx_articles_is_active RENAME TO idx_blog_posts_is_active;
ALTER INDEX IF EXISTS idx_articles_reading_time RENAME TO idx_blog_posts_reading_time;
ALTER INDEX IF EXISTS idx_articles_content_hash RENAME TO idx_blog_posts_content_hash;
ALTER INDEX IF EXISTS idx_articles_language RENAME TO idx_blog_posts_language;
ALTER INDEX IF EXISTS idx_articles_word_count RENAME TO idx_blog_posts_word_count;

-- Add comment for documentation
COMMENT ON TABLE blog_posts IS 'Main blog posts table for ballers.jp - stores all blog posts from Bubble.io (formerly named articles)';

