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
2804b8d2
Kaydet (Commit)
2804b8d2
authored
Ock 22, 2019
tarafından
Nasir Hussain
Kaydeden (comit)
Tim Graham
Ock 22, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #30111 -- Fixed AppRegistryNotReady error with django.contrib.postgres in INSTALLED_APPS.
Regression in
e192223e
.
üst
d02b2aa1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
13 deletions
+47
-13
recorder.py
django/db/migrations/recorder.py
+25
-13
integration_settings.py
tests/postgres_tests/integration_settings.py
+5
-0
test_integration.py
tests/postgres_tests/test_integration.py
+17
-0
No files found.
django/db/migrations/recorder.py
Dosyayı görüntüle @
2804b8d2
from
django.apps.registry
import
Apps
from
django.apps.registry
import
Apps
from
django.db
import
models
from
django.db
import
models
from
django.db.utils
import
DatabaseError
from
django.db.utils
import
DatabaseError
from
django.utils.decorators
import
classproperty
from
django.utils.timezone
import
now
from
django.utils.timezone
import
now
from
.exceptions
import
MigrationSchemaMissing
from
.exceptions
import
MigrationSchemaMissing
...
@@ -18,19 +19,30 @@ class MigrationRecorder:
...
@@ -18,19 +19,30 @@ class MigrationRecorder:
If a migration is unapplied its row is removed from the table. Having
If a migration is unapplied its row is removed from the table. Having
a row in the table always means a migration is applied.
a row in the table always means a migration is applied.
"""
"""
_migration_class
=
None
class
Migration
(
models
.
Model
):
app
=
models
.
CharField
(
max_length
=
255
)
@classproperty
name
=
models
.
CharField
(
max_length
=
255
)
def
Migration
(
cls
):
applied
=
models
.
DateTimeField
(
default
=
now
)
"""
Lazy load to avoid AppRegistryNotReady if installed apps import
class
Meta
:
MigrationRecorder.
apps
=
Apps
()
"""
app_label
=
"migrations"
if
cls
.
_migration_class
is
None
:
db_table
=
"django_migrations"
class
Migration
(
models
.
Model
):
app
=
models
.
CharField
(
max_length
=
255
)
def
__str__
(
self
):
name
=
models
.
CharField
(
max_length
=
255
)
return
"Migration
%
s for
%
s"
%
(
self
.
name
,
self
.
app
)
applied
=
models
.
DateTimeField
(
default
=
now
)
class
Meta
:
apps
=
Apps
()
app_label
=
'migrations'
db_table
=
'django_migrations'
def
__str__
(
self
):
return
'Migration
%
s for
%
s'
%
(
self
.
name
,
self
.
app
)
cls
.
_migration_class
=
Migration
return
cls
.
_migration_class
def
__init__
(
self
,
connection
):
def
__init__
(
self
,
connection
):
self
.
connection
=
connection
self
.
connection
=
connection
...
...
tests/postgres_tests/integration_settings.py
0 → 100644
Dosyayı görüntüle @
2804b8d2
SECRET_KEY
=
'abcdefg'
INSTALLED_APPS
=
[
'django.contrib.postgres'
,
]
tests/postgres_tests/test_integration.py
0 → 100644
Dosyayı görüntüle @
2804b8d2
import
os
import
subprocess
import
sys
from
tests.postgres_tests
import
PostgreSQLSimpleTestCase
class
PostgresIntegrationTests
(
PostgreSQLSimpleTestCase
):
def
test_check
(
self
):
os
.
chdir
(
os
.
path
.
dirname
(
__file__
))
result
=
subprocess
.
run
(
[
sys
.
executable
,
'-m'
,
'django'
,
'check'
,
'--settings'
,
'integration_settings'
],
stdout
=
subprocess
.
DEVNULL
,
stderr
=
subprocess
.
PIPE
,
)
stderr
=
'
\n
'
.
join
([
e
.
decode
()
for
e
in
result
.
stderr
.
splitlines
()])
self
.
assertEqual
(
result
.
returncode
,
0
,
msg
=
stderr
)
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