Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
de41fbb3
Kaydet (Commit)
de41fbb3
authored
Agu 11, 2015
tarafından
Caio Ariede
Kaydeden (comit)
Tim Graham
Agu 14, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #25239 -- Corrected makemigrations numbering if a migration has a number-only filename.
üst
52a190b6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
2 deletions
+28
-2
autodetector.py
django/db/migrations/autodetector.py
+3
-2
test_commands.py
tests/migrations/test_commands.py
+13
-0
0001.py
tests/migrations/test_migrations_order/0001.py
+12
-0
__init__.py
tests/migrations/test_migrations_order/__init__.py
+0
-0
No files found.
django/db/migrations/autodetector.py
Dosyayı görüntüle @
de41fbb3
...
...
@@ -1154,6 +1154,7 @@ class MigrationAutodetector(object):
Given a migration name, tries to extract a number from the
beginning of it. If no number found, returns None.
"""
if
re
.
match
(
r"^\d+_"
,
name
):
return
int
(
name
.
split
(
"_"
)[
0
])
match
=
re
.
match
(
r'^\d+'
,
name
)
if
match
:
return
int
(
match
.
group
())
return
None
tests/migrations/test_commands.py
Dosyayı görüntüle @
de41fbb3
...
...
@@ -510,6 +510,19 @@ class MakeMigrationsTests(MigrationTestBase):
self
.
assertIn
(
'
\\
xda
\\
xd1
\\
xcd
\\
xa2
\\
xd3
\\
xd0
\\
xc9'
,
content
)
# title.verbose_name
self
.
assertIn
(
'
\\
u201c
\\
xd0j
\\
xe1
\\
xf1g
\\
xf3
\\
u201d'
,
content
)
# title.default
def
test_makemigrations_order
(
self
):
"""
makemigrations should recognize number-only migrations (0001.py).
"""
module
=
'migrations.test_migrations_order'
with
self
.
temporary_migration_module
(
module
=
module
)
as
migration_dir
:
if
hasattr
(
importlib
,
'invalidate_caches'
):
# Python 3 importlib caches os.listdir() on some platforms like
# Mac OS X (#23850).
importlib
.
invalidate_caches
()
call_command
(
'makemigrations'
,
'migrations'
,
'--empty'
,
'-n'
,
'a'
,
'-v'
,
'0'
)
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
migration_dir
,
'0002_a.py'
)))
def
test_failing_migration
(
self
):
# If a migration fails to serialize, it shouldn't generate an empty file. #21280
apps
.
register_model
(
'migrations'
,
UnserializableModel
)
...
...
tests/migrations/test_migrations_order/0001.py
0 → 100644
Dosyayı görüntüle @
de41fbb3
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
initial
=
True
operations
=
[
]
tests/migrations/test_migrations_order/__init__.py
0 → 100644
Dosyayı görüntüle @
de41fbb3
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment