Search documentation of phoenix_kit

# PhoenixKit.Migrations.Postgres.V26 (phoenix_kit v1.6.19)

View Source

Migration V26: Rename checksum fields and add per-user deduplication.

This migration renames checksum fields for clarity and adds per-user file deduplication while preserving the ability to query for popular files across all users.

## Changes

- Enables `pgcrypto` extension for cryptographic functions
- Renames `checksum` column to `file_checksum` (for clarity)
- Drops unique index on `file_checksum` (allows same file from different users)
- Adds `user_file_checksum` column (SHA256 of user_id + file_checksum)
- Creates unique index on `user_file_checksum` to enforce per-user uniqueness
- Backfills existing records with calculated user_file_checksum values

## Requirements

- PostgreSQL with `pgcrypto` extension support (enabled automatically)

## Purpose

- Same user cannot upload the same file twice (duplicate prevention via user_file_checksum)
- Different users CAN upload the same file (no unique constraint on file_checksum)
- Original `file_checksum` field preserved for finding most popular images across all users
- Clearer naming: file_checksum vs user_file_checksum

# Summary

## Functions

down(opts)
up(opts)

# Functions

# down(opts)

# up(opts)