PhoenixKit.Migrations.Postgres.V24 (phoenix_kit v1.7.38)

Copy Markdown View Source

PhoenixKit V24 Migration: File Checksum Unique Index

This migration adds a unique index on the checksum field of the phoenix_kit_files table to enable efficient duplicate file detection and prevent duplicate file storage.

Changes

File Deduplication Support

  • Adds unique index on phoenix_kit_files.checksum for O(1) duplicate lookups
  • Enables automatic deduplication of uploaded files
  • Prevents redundant storage of identical files

PostgreSQL Support

  • Supports PostgreSQL prefix for schema isolation
  • Creates unique index for fast duplicate detection

Summary

Functions

Rollback the V24 file checksum indexing migration.

Run the V24 file checksum indexing migration.

Functions

down(opts)

Rollback the V24 file checksum indexing migration.

up(opts)

Run the V24 file checksum indexing migration.

Handles existing duplicate checksums by keeping the oldest file and deleting newer duplicates.