... です)。フィールドが null 許容でなく、デフォルト値を持たない場合、この操作は不可逆です。 Changed in Django 6.0: BaseDatabaseSchemaEditor and PostgreSQL backends no longer use CASCADE to delete dependent related database objects, such as views. Any depen ... 履歴において処理の場所が一致している履歴を反映したモデルを含んだ django.apps.registry.Apps のインスタンスであり、第二引数は SchemaEditor のインスタンスです。 reverse_code 引数はマイグレーションを元に戻す際に呼び出されます。この呼び出し可能オブジェクトは ... 用いて Country モデル上の初期オブジェクトを追加する例を示します: from django.db import migrations def forwards_func ( apps , schema_editor ): # We get the model from the versioned app registry; # if we directly import it, it'll be the wrong version Count ... ... ) in the WKBWriter class in an attempt to fix a random crash involving LooseVersion since Django 2.0.6 ( #29959 ). Fixed a schema corruption issue on SQLite 3.26+. You might have to drop and rebuild your SQLite database if you applied a migration while ... using an older version of Django with SQLite 3.26 or later ( #29182 ). Prevented SQLite schema alterations while foreign key checks are enabled to avoid the possibility of schema corruption ( #30023 ). ... ... the issue for custom templates that use the path. バグ修正 Fixed compatibility with mysqlclient 1.3.14 ( #30013 ). Fixed a schema corruption issue on SQLite 3.26+. You might have to drop and rebuild your SQLite database if you applied a migration while ... using an older version of Django with SQLite 3.26 or later ( #29182 ). Prevented SQLite schema alterations while foreign key checks are enabled to avoid the possibility of schema corruption ( #30023 ). Fixed a regress ... ... ません。例えば、特定のデータベースに対してのみマイグレーションを実行したい場合です。 これを行うには、 RunPython 操作の中で、 schema_editor.connection.alias 属性を見て、データベース接続のエイリアスを確認します: from django.db import migrations def forward ... s ( apps , schema_editor ): if schema_editor . connection . alias != "default" : return # Your migration code goes here class Migration ( mi ... return True これをマイグレーションに利用するには、次のようにします: from django.db import migrations def forwards ( apps , schema_editor ): # Your migration code goes here ... class Migration ( migrations . Migration ): dependencies = [ # Dependencies ... ... 」や「フィールドを削除する」といった操作を SQL に変換する、データベースの抽象レイヤーの部分です。後者の仕事を担当するのが、 SchemaEditor です。 Django を使っている普通の開発者が SchemaEditor を直接扱うことはほとんどありませんが、自前のマイグレーションシ ... た場合には、SQL を書くのではなく、こちらを選びましょう。 Django のデータベースのバックエンドは、それぞれ対応するバージョンの SchemaEditor を提供しており、好きなときに connection.schema_editor() コンテキストマネージャを使ってアクセスできます。 with connec ... tion . schema_editor () as schema_editor : schema_editor . delete_model ( MyModel ) これは、トランザクションや遅延SQL ( ForeignKey 制約の ... ... the static.serve view from producing ResourceWarning s in certain circumstances (security fix regression, #24193 ). Fixed schema check for ManyToManyField to look for internal type instead of checking class instance, so you can write custom m2m-like f ... ... features they aimed to implement were never finished: full-history generic-auth multiple-db-support per-object-permissions schema-evolution schema-evolution-ng search-api sqlalchemy Finally, under the archive/ prefix, the repository contains soc20XX/<p ... ... ilities and base classes d django.db django.db.backends Core signals sent by the database wrapper. django.db.backends.base.schema django.db.migrations Schema migration support for Django models django.db.migrations.operations django.db.models django.db ... ... support policy , Django 1.6 will continue to receive security support until the release of Django 1.8. Django 1.7 の新機能 Schema migrations Django now has built-in support for schema migrations. It allows models to be updated, changed, and deleted by ... is should make it easier to diagnose import issues such as import loops. New method on Field subclasses To help power both schema migrations and to enable easier addition of composite keys in future releases of Django, the Field API now has a new requi ... your model classes); this has the added advantage that your initial data will not need updating every time you change the schema. Additionally, like the rest of Django's old syncdb code, initial_data has been started down the deprecation path and will ... ... perations that changed only the Python-level on_delete option of ForeignKey or OneToOneField fields to perform unnecessary schema changes ( #37260 ). Fixed a bug in Django 6.1 where DecimalField without max_digits and decimal_places caused a crash when ... 2026年10月08日