diff --git a/db/migrations/20250318072657_replace_slug_index_with_covering_index.sql b/db/migrations/20250318072657_replace_slug_index_with_covering_index.sql index 78e3db6..8db23a9 100644 --- a/db/migrations/20250318072657_replace_slug_index_with_covering_index.sql +++ b/db/migrations/20250318072657_replace_slug_index_with_covering_index.sql @@ -1,10 +1,9 @@ -- +micrate Up -- SQL in section 'Up' is executed when this migration is applied -DROP INDEX IF EXISTS index_links_slug; --- Create the new covering index that includes id and url -CREATE INDEX IF NOT EXISTS idx_links_slug ON links (id, slug, url); +DROP INDEX IF EXISTS idx_links_slug; -- Remove old composite index +CREATE INDEX IF NOT EXISTS idx_links_slug_optimized ON links (slug, url); -- +micrate Down -- SQL in section 'Down' is executed when this migration is rolled back -DROP INDEX IF EXISTS idx_links_slug; -CREATE INDEX IF NOT EXISTS index_links_slug ON links (slug); +DROP INDEX IF EXISTS idx_links_slug_optimized; +CREATE INDEX IF NOT EXISTS idx_links_slug ON links (id, slug, url);