From be9113ea3fa22ada0e62298e662993f9a8455ce1 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Mon, 27 Apr 2015 00:54:02 +0200 Subject: [PATCH] Note for future unique constraint on image_fingerprint added --- README.Developer | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.Developer b/README.Developer index fdb18bc..f5cb03b 100644 --- a/README.Developer +++ b/README.Developer @@ -61,3 +61,19 @@ Log.log "foo" or with section (default='frontend'): Log.log "foo", "importer" +-- + +Future stuff +------------ + +A possible migration adding a unique constraint to avoid duplicate images + +class AddScreenshotUniqueConstraintImageFingerprint < ActiveRecord::Migration + def change + add_index :screenshots, [:package_id, :image_fingerprint], :unique => true + end +end + +A separate validation in the Screenshots model has been implemented already. +This unique constraint would raise an error and not trigger a validation error +properly unless the separate model validation is in place.