... く使うコマンドを、いくつか挙げておきましょう。 migrate は、マイグレーションを適用したり、適用をキャンセルするのに使います。 makemigrations は、モデルに対して行った変更をもとに、新しいマイグレーションを作成します。 sqlmigrate は、マイグレーションに対応する SQL 文 ... ステータスをリストします。 マイグレーションというのは、データベーススキーマに対するバージョン管理システムのようなものです。 makemigrations はモデルの変更点を1つのマイグレーションファイルにパッケージングし(コミットのようなものです)、 migrate はその変更点をデータ ... あなたに代わってマイグレーションを作成します。たとえば、フィールドを追加してモデルを削除するなど、モデルに変更を加えてから、 makemigrations を実行してください。 $ python manage.py makemigrations Migrations for 'books' : books/migrations/0003_auto.py: ~ Alter fie ... ... する事もできます。 もし独自の Operation オブジェクトを定義する空のマイグレーションファイルが必要であれば、 python manage.py makemigrations --empty yourappname を実行してください。ただし、手動でのスキーマ変更オペレーションの追加はマイグレーションの自動検出機構を ... 混乱させ、 makemigrations が正しい結果を出力しなくなる可能性があることに十分注意してください。 Django が提供するコア機能は全て django.db.migrations. ... す可能性があります。これを避けるには、以下の手順を実行する必要があります。 デフォルト値なしで nullable フィールドを追加し、 makemigrations コマンドを実行します。これで AddField オペレーションを持つマイグレーションが生成されるはずです。 デフォルト値をフィールドに ... ... incorrect repr of ResolverMatch for class-based views ( #33426 ). Fixed a regression in Django 4.0 that caused a crash of makemigrations on models without Meta.order_with_respect_to but with a field named _order ( #33449 ). Fixed a regression in Django 4.0 th ... ter annotate() on an aggregate function with a default ( #33468 ). Fixed a regression in Django 4.0 that caused a crash of makemigrations when renaming a field of a renamed model ( #33480 ). ... ... igrate コマンドラインオプション --blank ogrinspect コマンドラインオプション --buffer test コマンドラインオプション --check makemigrations コマンドラインオプション migrate コマンドラインオプション optimizemigration コマンドラインオプション --clear collectstatic ... ssages コマンドラインオプション --dry-run collectstatic コマンドラインオプション createcachetable コマンドラインオプション makemigrations コマンドラインオプション --durations test コマンドラインオプション --email createsuperuser コマンドラインオプション --empt ... y makemigrations コマンドラインオプション --exclude compilemessages コマンドラインオプション dumpdata コマンドラインオプション loaddata コマ ... ... ions when combined with lookups on PostGIS ( #27014 ). Reallowed the {% for %} tag to unpack any iterable ( #27058 ). Made makemigrations skip inconsistent history checks on non-default databases if database routers aren't in use or if no apps can be migrated ... ble to be generalized like that ( #26998 ). Added the database alias to the InconsistentMigrationHistory message raised by makemigrations and migrate ( #27089 ). Fixed the creation of ContentType and Permission objects for models of applications without migrat ... ... ausing IntegrityError ( #23611 ). Made urlsafe_base64_decode() return the proper type (bytestring) on Python 3 ( #23333 ). makemigrations can now serialize timezone-aware values ( #23365 ). Added a prompt to the migrations questioner when removing the null con ... Oracle test database creation drop the test user in the event of an unclean exit of a previous test run ( #23649 ). Fixed makemigrations to detect changes to Meta.db_table ( #23629 ). Fixed a regression when feeding the Django test client with an empty data s ... ... ... directs to absolute URIs ( #26428 ). Fixed TimeField microseconds round-tripping on MySQL and SQLite ( #26498 ). Prevented makemigrations from generating infinite migrations for a model field that references a functools.partial ( #26475 ). Fixed a regression w ... ... e form fields. This issue was introduced by the bpo-43882 fix. バグ修正 Prevented, following a regression in Django 3.2.1, makemigrations from generating infinite migrations for a model with Meta.ordering contained OrderBy expressions ( #32714 ). ... ... 際化 (internationalization) The i18n_patterns() function now supports languages with both scripts and regions. 管理コマンド makemigrations --no-input now logs default answers and reasons why migrations cannot be created. The new makemigrations --scriptable opti ... xistent migrations from the django_migrations table. Python files created by startproject , startapp , optimizemigration , makemigrations , and squashmigrations are now formatted using the black command if it is present on your PATH . The new optimizemigration ... aint.expressions . To use it, you need to add 'django.contrib.postgres' in your INSTALLED_APPS . After making this change, makemigrations will generate a new migration with two operations: RemoveConstraint and AddConstraint . Since this change has no effect on ... 2026年10月08日