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
c7bf4c27
Kaydet (Commit)
c7bf4c27
authored
Kas 06, 2013
tarafından
Andrew Godwin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Allow squashing of squashed migrations
üst
106b019d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
squashmigrations.py
django/core/management/commands/squashmigrations.py
+12
-3
No files found.
django/core/management/commands/squashmigrations.py
Dosyayı görüntüle @
c7bf4c27
...
@@ -37,9 +37,9 @@ class Command(BaseCommand):
...
@@ -37,9 +37,9 @@ class Command(BaseCommand):
try
:
try
:
migration
=
executor
.
loader
.
get_migration_by_prefix
(
app_label
,
migration_name
)
migration
=
executor
.
loader
.
get_migration_by_prefix
(
app_label
,
migration_name
)
except
AmbiguityError
:
except
AmbiguityError
:
raise
CommandError
(
"More than one migration matches '
%
s' in app '
%
s'. Please be more specific."
%
(
app_label
,
migration_name
))
raise
CommandError
(
"More than one migration matches '
%
s' in app '
%
s'. Please be more specific."
%
(
migration_name
,
app_label
))
except
KeyError
:
except
KeyError
:
raise
CommandError
(
"Cannot find a migration matching '
%
s' from app '
%
s'."
%
(
app_label
,
migration_name
))
raise
CommandError
(
"Cannot find a migration matching '
%
s' from app '
%
s'."
%
(
migration_name
,
app_label
))
# Work out the list of predecessor migrations
# Work out the list of predecessor migrations
migrations_to_squash
=
[
migrations_to_squash
=
[
...
@@ -83,11 +83,20 @@ class Command(BaseCommand):
...
@@ -83,11 +83,20 @@ class Command(BaseCommand):
else
:
else
:
self
.
stdout
.
write
(
" Optimized from
%
s operations to
%
s operations."
%
(
len
(
operations
),
len
(
new_operations
)))
self
.
stdout
.
write
(
" Optimized from
%
s operations to
%
s operations."
%
(
len
(
operations
),
len
(
new_operations
)))
# Work out the value of replaces (any squashed ones we're re-squashing)
# need to feed their replaces into ours
replaces
=
[]
for
migration
in
migrations_to_squash
:
if
migration
.
replaces
:
replaces
.
extend
(
migration
.
replaces
)
else
:
replaces
.
append
((
migration
.
app_label
,
migration
.
name
))
# Make a new migration with those operations
# Make a new migration with those operations
subclass
=
type
(
"Migration"
,
(
migrations
.
Migration
,
),
{
subclass
=
type
(
"Migration"
,
(
migrations
.
Migration
,
),
{
"dependencies"
:
[],
"dependencies"
:
[],
"operations"
:
new_operations
,
"operations"
:
new_operations
,
"replaces"
:
[(
m
.
app_label
,
m
.
name
)
for
m
in
migrations_to_squash
]
,
"replaces"
:
replaces
,
})
})
new_migration
=
subclass
(
"0001_squashed_
%
s"
%
migration
.
name
,
app_label
)
new_migration
=
subclass
(
"0001_squashed_
%
s"
%
migration
.
name
,
app_label
)
...
...
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