]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
prettier revision identifier (always exatly 12 hex digits long) with better guarantee...
authorantti_haapala <antti@haapala.name>
Sun, 29 Nov 2015 16:27:57 +0000 (16:27 +0000)
committerantti_haapala <antti@haapala.name>
Sun, 29 Nov 2015 16:27:57 +0000 (16:27 +0000)
Rationale: with the current code most revision ids start with 1, 2, 3 or 4, and there are far more collisions with 2 initial digits than necessary (cumbersome to check a file by revision on command line and such). So instead of revision ids that are 1-12 digits long with ~45 bits of information, lets just have them 12 digits long and contain full 48 bits of info.

alembic/util/langhelpers.py

index 54e5e806ca09177219f2c918c0ecf1a1d2c8ce56..a556e943943622c5bd2fb8bcf7fe4351b3984558 100644 (file)
@@ -182,8 +182,7 @@ def asbool(value):
 
 
 def rev_id():
-    val = int(uuid.uuid4()) % 100000000000000
-    return hex(val)[2:-1]
+    return uuid.uuid4().hex[-12:]
 
 
 def to_list(x, default=None):