We have a set of template files which can be copied by users and modified later. We have a unique constraint on the “name” field, so when some user copies a template file say “File 1” we add it as “Copy of File 1” and if he copies a template file say “File 2” we add it as “Copy of File 2” (i.e. we add an appropriate prefix, when we copy these files) so we don’t violate the unique constraint.
But if he adds the same file “File 1” again we run into a unique constraint violation error, what kind of naming convention should I follow, so that I can make it intuitive enough for the end user.
You could add the date of when the copy was made to the filename. Adjust the precision to the time frame least likely to cause a problem.
Also, I prefer suffixes to prefixes for copies so that the copy is stored next to the original.