summaryrefslogtreecommitdiff
path: root/django/db/migrations/utils.py
diff options
context:
space:
mode:
authorRaphael Gaschignard <r.gaschignard@gmail.com>2016-05-11 21:19:19 +0900
committerTim Graham <timograham@gmail.com>2016-05-11 08:19:19 -0400
commit8f6a1a15516629b30e2fa2c48d5e682f7955868c (patch)
tree9c0401fcdd2c61a2267bf5d17aa538d22bc76e3f /django/db/migrations/utils.py
parent535660b852c8899a17b82d20a06c926d8d437db3 (diff)
downloaddjango-8f6a1a15516629b30e2fa2c48d5e682f7955868c.tar.gz
Fixed #26429 -- Added a timestamp to merge migration names.
This reduces the possibility of a naming conflict, especially after squashing migrations.
Diffstat (limited to 'django/db/migrations/utils.py')
-rw-r--r--django/db/migrations/utils.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/db/migrations/utils.py b/django/db/migrations/utils.py
index 5bea82dc51..b54d7ed120 100644
--- a/django/db/migrations/utils.py
+++ b/django/db/migrations/utils.py
@@ -1,3 +1,4 @@
+import datetime
import re
COMPILED_REGEX_TYPE = type(re.compile(''))
@@ -10,3 +11,7 @@ class RegexObject(object):
def __eq__(self, other):
return self.pattern == other.pattern and self.flags == other.flags
+
+
+def get_migration_name_timestamp():
+ return datetime.datetime.now().strftime("%Y%m%d_%H%M")