summaryrefslogtreecommitdiff
path: root/docs/build/tutorial.rst
diff options
context:
space:
mode:
authorCaio Carvalho <21188280+lowercase00@users.noreply.github.com>2022-05-03 13:20:18 -0400
committerFederico Caselli <cfederico87@gmail.com>2022-05-06 20:30:39 +0000
commit0adcc749183abe17beab0baa07d8b1b1ac6a55d2 (patch)
treeea0bf6b93cf6021db77a5f6ccf5fce43dc5b389a /docs/build/tutorial.rst
parent1684d0ee89c0fc6b0b90bc5db614468b31119e9d (diff)
downloadalembic-0adcc749183abe17beab0baa07d8b1b1ac6a55d2.tar.gz
Add epoch as an option for file_template
Added new token ``epoch`` to the ``file_template`` option, which will populate the integer epoch as determined by ``int(create_date.timestamp())``. Pull request courtesy Caio Carvalho. Fixes: #1027 Closes: #1028 Pull-request: https://github.com/sqlalchemy/alembic/pull/1028 Pull-request-sha: 27970cd5d4e047cb7aabd161c68b757b2ee3e4c4 Change-Id: I73e13009bae91e64681a605b3f0b62ea1e5fc464
Diffstat (limited to 'docs/build/tutorial.rst')
-rw-r--r--docs/build/tutorial.rst5
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/build/tutorial.rst b/docs/build/tutorial.rst
index 5bfab91..17034c1 100644
--- a/docs/build/tutorial.rst
+++ b/docs/build/tutorial.rst
@@ -274,11 +274,16 @@ This file contains the following features:
* ``%%(rev)s`` - revision id
* ``%%(slug)s`` - a truncated string derived from the revision message
+ * ``%%(epoch)s`` - epoch timestamp based on the create date; this makes
+ use of the Python ``datetime.timestamp()`` method to produce an epoch
+ value.
* ``%%(year)d``, ``%%(month).2d``, ``%%(day).2d``, ``%%(hour).2d``,
``%%(minute).2d``, ``%%(second).2d`` - components of the create date,
by default ``datetime.datetime.now()`` unless the ``timezone``
configuration option is also used.
+ .. versionadded:: 1.8 added 'epoch'
+
* ``timezone`` - an optional timezone name (e.g. ``UTC``, ``EST5EDT``, etc.)
that will be applied to the timestamp which renders inside the migration
file's comment as well as within the filename. This option requires installing