From 392eb2744dff4cc84f6248f9e5d92ebb5fbcbda2 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Fri, 2 Mar 2018 00:17:23 +0100 Subject: [PATCH] ADD: comment --- .../dbmigration/ddlgeneration/platform/PlatformDdl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl.java b/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl.java index 145fd6fc2..14fb23163 100644 --- a/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl.java +++ b/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl.java @@ -623,6 +623,14 @@ public class PlatformDdl { } + /** + * Shortens the given name to the maximum constraint name length of the platform in a deterministic way. + * + * First, all vowels are removed, If the string is still to long, 31 bits are taken from the hash code + * of the string and base36 encoded (10 digits and 26 chars) string. + * + * As 36^6 > 31^2, the resulting string is never longer as 6 chars. + */ protected String maxConstraintName(String name) { if (name.length() > platform.getMaxConstraintNameLength()) { int hash = name.hashCode() & 0x7FFFFFFF;