PHP Classes

File: SQL File

Recommend this page to a friend!
  Packages of Matthew Asham   Binkterm PHP   database/migrations/v1.11.0.23_files_hash_nonunique.sql   Download  
File: database/migrations/v1.11.0.23_files_hash_nonunique.sql
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Binkterm PHP
Bulletin board system based on the Web
Author: By
Last change:
Date: 5 days ago
Size: 814 bytes
 

Contents

Class file image Download
-- Migration: v1.11.0.23 - Replace unique file hash constraint with plain index -- -- The UNIQUE(file_area_id, file_hash) constraint breaks local netmail attachment -- delivery when the same file is sent more than once to the same recipient. -- The INSERT for the second attachment throws a constraint violation after the -- file has already been moved from the temp dir, leaving an orphaned file on -- disk with no database record. -- -- Private areas legitimately receive the same file multiple times (e.g. the -- same attachment from different netmail messages). Drop the unique constraint -- and replace it with a plain index to keep lookup performance. ALTER TABLE files DROP CONSTRAINT IF EXISTS unique_file_hash_per_area; CREATE INDEX IF NOT EXISTS idx_files_area_hash ON files(file_area_id, file_hash);