... 性のために django.db.models にインポートされています。標準的な規約は from django.db import models を使い、制約を models.<Foo>Constraint と呼ぶことです。 抽象基底クラスにおける制約 制約には常にユニークな名前を指定する必要があります。また、通常は抽象基底クラス ... で制約を指定することはできません。なぜなら Meta.constraints オプションはサブクラスに継承され、そのたびに( name を含む)属性がまったく同じ値になってしまうからです。名前の衝突を回避す ... )s' と '%(class)s' を含めることができ、これにより小文字化されたアプリラベルと具体モデルのクラス名に置き換えられます。 CheckConstraint ( condition = Q ( age__gte = 18 ), name = " %(app_label)s _ %(class)s _is_adult" ) 制約のバリデーション 制約は モデルのバリ ... ... rename_index ( model , old_index , new_index ) [ソース] model のテーブルの old_index を new_index に名前を変更します。 add_constraint() BaseDatabaseSchemaEditor. add_constraint ( model , constraint ) [ソース] model のテーブルに constraint を追加します。 re ... move_constraint() BaseDatabaseSchemaEditor. remove_constraint ( model , constraint ) [ソース] model のテーブルから constraint を削除します ... ... ailable on the "mysql" backend, and will not be made available for "mysql_old". データベース名の制約変更 The format of the constraint names Django generates for foreign key references have changed slightly. These names are generally only used when it is no ... ge is that running manage.py reset and similar commands against an existing database may generate SQL with the new form of constraint name, while the database itself contains constraints named in the old form; this will cause the database server to raise a ... n error message about modifying nonexistent constraints. If you need to work around this, there are two methods available: Redirect the output of manage.py to a file, and edit t ... ... ango 1.1 you should double-check that the following changes don't impact you, and upgrade your code if they do. Changes to constraint names Django 1.1 modifies the method used to generate database constraint names so that names are consistent regardless of ... 4 ビットプラットフォームでは、以下に示すように制約名を64ビットで16文字に省略していました。 ALTER TABLE myapp_sometable ADD CONSTRAINT object_id_refs_id_5e8f10c132091d1e FOREIGN KEY ... この変更に伴い、すべてのプラットフォームで、ワードサイズに関係なく、制約 ... 名は32ビットで8文字に省略されるようになります。 ALTER TABLE myapp_sometable ADD CONSTRAINT object_id_refs_id_32091d1e FOREIGN KEY ... As a result of this change, you will not be able to use the reset management co ... ... now done in the template using the |stringformat:'s' filter. Prevented a primary key alteration from adding a foreign key constraint if db_constraint=False ( #28298 ). Fixed UnboundLocalError crash in RenameField with nonexistent field ( #28350 ). Fixed a ... ... lete to not set the primary key to None ( #30330 ). Prevented makemigrations from generating infinite migrations for check constraints and partial indexes when condition contains a range object ( #30350 ). Reverted an optimization in Django 2.2 ( #29725 ) ... by auto-reloader when using StatReloader ( #30323 ). Fixed a migration crash on Oracle and PostgreSQL when adding a check constraint with a contains , startswith , or endswith lookup (or their case-insensitive variant) ( #30408 ). Fixed a migration crash ... on Oracle and SQLite when adding a check constraint with condition contains | ( OR ) operator ( #30412 ). ... ... generation for models with quoted db_table ( #28876 ). Fixed incorrect foreign key constraint name for models with quoted db_table ( #28876 ). Fixed a regression in caching of a GenericForeignKey when the referenced ... ... Hant and zh_TW ) have been added. Formats for Macedonian have been fixed (trailing dot removed, #23532 ). Added quoting of constraint names in the SQL generated by migrations to prevent crash with uppercase characters in the name ( #23065 ). Fixed renaming ... ( #23426 ). TEST 辞書の SERIALIZE 項目を使用可能にしました ( #23421 )。 Fixed bug in migrations that prevented foreign key constraints to unmanaged models with a custom primary key ( #23415 ). Added SchemaEditor for MySQL GIS backend so that spatial indexe ... ons can now serialize timezone-aware values ( #23365 ). Added a prompt to the migrations questioner when removing the null constraint from a field to prevent an IntegrityError on existing NULL rows ( #23609 ). Fixed generic relations in ModelAdmin.list_fil ... ... ... 2026年10月08日