summaryrefslogtreecommitdiff
path: root/docs/ref/databases.txt
diff options
context:
space:
mode:
authorCarlton Gibson <carlton.gibson@noumenal.es>2023-02-09 16:48:46 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-02-10 21:12:06 +0100
commitb784768eef75afb32f6d2ce7166551a528bce0ec (patch)
treea375a57a50f1766538ea8a62ec49bda352d7f2b9 /docs/ref/databases.txt
parent4a89aa25c91e520c247aee428782274dcf10ffd0 (diff)
[4.2.x] Refs #34140 -- Applied rst code-block to non-Python examples.
Thanks to J.V. Zammit, Paolo Melchiorre, and Mariusz Felisiak for reviews. Backport of 534ac4829764f317cf2fbc4a18354fcc998c1425 from main.
Diffstat (limited to 'docs/ref/databases.txt')
-rw-r--r--docs/ref/databases.txt22
1 files changed, 17 insertions, 5 deletions
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt
index 6755085336..0885af35e1 100644
--- a/docs/ref/databases.txt
+++ b/docs/ref/databases.txt
@@ -352,7 +352,9 @@ Django uses PostgreSQL's identity columns to store auto-incrementing primary
keys. An identity column is populated with values from a `sequence`_ that keeps
track of the next available value. Manually assigning a value to an
auto-incrementing field doesn't update the field's sequence, which might later
-cause a conflict. For example::
+cause a conflict. For example:
+
+.. code-block:: pycon
>>> from django.contrib.auth.models import User
>>> User.objects.create(username='alice', pk=1)
@@ -500,7 +502,9 @@ This needs to be done just once for your MySQL server, not per database.
Creating your database
----------------------
-You can `create your database`_ using the command-line tools and this SQL::
+You can `create your database`_ using the command-line tools and this SQL:
+
+.. code-block:: sql
CREATE DATABASE <dbname> CHARACTER SET utf8;
@@ -581,6 +585,8 @@ Here's a sample configuration which uses a MySQL option file::
}
+.. code-block:: ini
+
# my.cnf
[client]
database = NAME
@@ -650,7 +656,9 @@ If you're using a hosting service and can't change your server's default
storage engine, you have a couple of options.
* After the tables are created, execute an ``ALTER TABLE`` statement to
- convert a table to a new storage engine (such as InnoDB)::
+ convert a table to a new storage engine (such as InnoDB):
+
+ .. code-block:: sql
ALTER TABLE <tablename> ENGINE=INNODB;
@@ -730,7 +738,9 @@ includes a fractional indication (e.g. ``DATETIME(6)``).
Django will not upgrade existing columns to include fractional seconds if the
database server supports it. If you want to enable them on an existing database,
it's up to you to either manually update the column on the target database, by
-executing a command like::
+executing a command like:
+
+.. code-block:: sql
ALTER TABLE `your_table` MODIFY `your_datetime_column` DATETIME(6)
@@ -1126,7 +1136,9 @@ database backends to modify its behavior, features, or configuration.
Consider, for example, that you need to change a single database feature.
First, you have to create a new directory with a ``base`` module in it. For
-example::
+example:
+
+.. code-block:: text
mysite/
...