... ることなく、 model_name で指定したモデルの name という名前の制約を新たな constraint に置き換えます。 特別なオペレーション ¶ RunSQL ¶ class RunSQL ( sql , reverse_sql = None , state_operations = None , hints = None , elidable = False ) [ソース] ¶ データベ ... メータを cursor.execute() において行うのと同じ形式で渡すために用いられます。以下の 3 つの処理は互いに等価です: migrations . RunSQL ( "INSERT INTO musician (name) VALUES ('Reinhardt');" ) migrations . RunSQL ([( "INSERT INTO musician (name) VALUES ('Rein ... hardt');" , None )]) migrations . RunSQL ([( "INSERT INTO musician (name) VALUES ( %s );" , [ "Reinhardt" ])]) クエリにパーセント文字リテラルを含ませたい場合、パラ ... ... ることなく、 model_name で指定したモデルの name という名前の制約を新たな constraint に置き換えます。 特別なオペレーション ¶ RunSQL ¶ class RunSQL ( sql , reverse_sql = None , state_operations = None , hints = None , elidable = False ) [ソース] ¶ データベ ... メータを cursor.execute() において行うのと同じ形式で渡すために用いられます。以下の 3 つの処理は互いに等価です: migrations . RunSQL ( "INSERT INTO musician (name) VALUES ('Reinhardt');" ) migrations . RunSQL ([( "INSERT INTO musician (name) VALUES ('Rein ... hardt');" , None )]) migrations . RunSQL ([( "INSERT INTO musician (name) VALUES ( %s );" , [ "Reinhardt" ])]) クエリにパーセント文字リテラルを含ませたい場合、パラ ... ... migrations ] operations = [ migrations . RunPython ( forwards , hints = { "target_db" : "default" }), ] もし RunPython や RunSQL 操作が 1 つのモデルにしか影響しないのであれば、 model_name をヒントとして渡すことで、ルーターに対して最大限、透過的になりま ... し、すべての行に一意な値を設定するまで、一意制約の作成を延期します。 最初の空のマイグレーションファイルに、 RunPython または RunSQL オペレーションを追加して、既存の各行に対して一意な値 (この例では UUID) を生成します。 uuid のインポートも追加します。例: 0 ... erations = [ # Old table name from checking with sqlmigrate, new table # name from AuthorBook._meta.db_table. migrations . RunSQL ( sql = "ALTER TABLE core_book_authors RENAME TO core_authorbook" , reverse_sql = "ALTER TABLE core_authorbook RENAME TO c ... ... migrations ] operations = [ migrations . RunPython ( forwards , hints = { "target_db" : "default" }), ] もし RunPython や RunSQL 操作が 1 つのモデルにしか影響しないのであれば、 model_name をヒントとして渡すことで、ルーターに対して最大限、透過的になりま ... し、すべての行に一意な値を設定するまで、一意制約の作成を延期します。 最初の空のマイグレーションファイルに、 RunPython または RunSQL オペレーションを追加して、既存の各行に対して一意な値 (この例では UUID) を生成します。 uuid のインポートも追加します。例: 0 ... erations = [ # Old table name from checking with sqlmigrate, new table # name from AuthorBook._meta.db_table. migrations . RunSQL ( sql = "ALTER TABLE core_book_authors RENAME TO core_authorbook" , reverse_sql = "ALTER TABLE core_authorbook RENAME TO c ... ... to the django.request logger when a middleware raises a MiddlewareNotUsed exception in DEBUG mode. マイグレーション ¶ The RunSQL operation can now handle parameters passed to the SQL statements. It is now possible to have migrations (most probably dat ... part of the model state. A generic mechanism to handle the deprecation of model fields was added. The RunPython.noop() and RunSQL.noop class method/attribute were added to ease in making RunPython and RunSQL operations reversible. The migration operati ... ons RunPython and RunSQL now call the allow_migrate() method of database routers. The router can use the newly introduced app_label and hints argum ... ... to the django.request logger when a middleware raises a MiddlewareNotUsed exception in DEBUG mode. マイグレーション ¶ The RunSQL operation can now handle parameters passed to the SQL statements. It is now possible to have migrations (most probably dat ... part of the model state. A generic mechanism to handle the deprecation of model fields was added. The RunPython.noop() and RunSQL.noop class method/attribute were added to ease in making RunPython and RunSQL operations reversible. The migration operati ... ons RunPython and RunSQL now call the allow_migrate() method of database routers. The router can use the newly introduced app_label and hints argum ... ... ). Added the get_extra() , get_max_num() , and get_min_num() hooks to GenericInlineModelAdmin ( #23539 ). Made migrations.RunSQL no longer require percent sign escaping. This is now consistent with cursor.execute() ( #23426 ). TEST 辞書の SERIALIZE 項 ... ... ). Added the get_extra() , get_max_num() , and get_min_num() hooks to GenericInlineModelAdmin ( #23539 ). Made migrations.RunSQL no longer require percent sign escaping. This is now consistent with cursor.execute() ( #23426 ). TEST 辞書の SERIALIZE 項 ... ... ケースを追加するのを避けようとします。データベース固有のオプションを使いたければ、あなたが指定したい ALTER TABLE 文を含めた RunSQL を使ったマイグレーションを作成してください。 たとえば、 MySQL を使っていて、 MyISAM ストレージエンジンを使いたい場合、以下 ... ... for cyclic dependencies much more helpful. Added missing index_together handling for SQLite ( #23880 ). Fixed a crash when RunSQL SQL content was collected by the schema editor, typically when using sqlmigrate ( #23909 ). Fixed a regression in contrib. ... 2026年10月08日