Kaydet (Commit) 95edabb4 authored tarafından Flavio Curella's avatar Flavio Curella Kaydeden (comit) Tim Graham

Fixed #25430 -- Fixed incorrect RunSQL examples.

üst c3904deb
...@@ -218,8 +218,8 @@ queries and parameters in the same way as :ref:`cursor.execute() ...@@ -218,8 +218,8 @@ queries and parameters in the same way as :ref:`cursor.execute()
<executing-custom-sql>`. These three operations are equivalent:: <executing-custom-sql>`. These three operations are equivalent::
migrations.RunSQL("INSERT INTO musician (name) VALUES ('Reinhardt');") migrations.RunSQL("INSERT INTO musician (name) VALUES ('Reinhardt');")
migrations.RunSQL(["INSERT INTO musician (name) VALUES ('Reinhardt');", None]) migrations.RunSQL([("INSERT INTO musician (name) VALUES ('Reinhardt');", None)])
migrations.RunSQL(["INSERT INTO musician (name) VALUES (%s);", ['Reinhardt']]) migrations.RunSQL([("INSERT INTO musician (name) VALUES (%s);", ['Reinhardt'])])
If you want to include literal percent signs in the query, you have to double If you want to include literal percent signs in the query, you have to double
them if you are passing parameters. them if you are passing parameters.
...@@ -228,8 +228,8 @@ The ``reverse_sql`` queries are executed when the migration is unapplied, so ...@@ -228,8 +228,8 @@ The ``reverse_sql`` queries are executed when the migration is unapplied, so
you can reverse the changes done in the forwards queries:: you can reverse the changes done in the forwards queries::
migrations.RunSQL( migrations.RunSQL(
["INSERT INTO musician (name) VALUES (%s);", ['Reinhardt']], [("INSERT INTO musician (name) VALUES (%s);", ['Reinhardt'])],
["DELETE FROM musician where name=%s;", ['Reinhardt']], [("DELETE FROM musician where name=%s;", ['Reinhardt'])],
) )
The ``state_operations`` argument is so you can supply operations that are The ``state_operations`` argument is so you can supply operations that are
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment