docs: update migrations docs

- add a note about mapping database_url to an environment variable
- update migration file structure pages to reflect new changes.

https://github.com/hasura/graphql-engine-mono/pull/1629

GitOrigin-RevId: 2ca891aa4cacb7528159c8793b9f6ca470e1fa7d
This commit is contained in:
Aravind K P 2021-06-22 23:08:19 +05:30 committed by hasura-bot
parent c0fde4d1d5
commit 5099ef077b
2 changed files with 18 additions and 17 deletions

View File

@ -242,6 +242,16 @@ databases.yaml
- "!include public_t1.yaml"
functions: []
.. note::
``database_url`` can be set from an environment variable
by specifying it as:
.. code-block:: yaml
database_url:
from_env: SOME_ENVIRONMENT_VARIABLE
public_t1.yaml
^^^^^^^^^^^^^^

View File

@ -22,26 +22,17 @@ The ``config V3`` migrations files generated by the CLI are pure SQL files.
For ``config v2``, see :ref:`migration_file_format_v2`.
Migration filename format
Migration Directory format
-------------------------
Each migration file has the following format:
Each migration is stored inside a directory, which has the following structure:
.. code-block:: bash
<version>_<name>.{up|down}.sql
A ``version`` which is the Unix timestamp in nanoseconds when the file was
created is the first part. Followed by a ``name`` which is either manually added
or auto-generated by the console. The next part indicates what step this is. If
it is ``up``, it means that this is the forward step, e.g. creating a table.
The ``down`` indicates that it is the corresponding
rollback step.
Migration file format
---------------------
A migration SQL file can contain SQL statements which are executed
on the apply step of the migration. There can be an ``up`` migration and a ``down``
migration file.
<version>_<name>/{up|down}.sql
A ``version`` which is the Unix timestamp in nanoseconds when the migration was
created is the first part of the name of the directory. Followed by a ``name`` which is either manually added
or auto-generated by the console. The files inside this directory indicates what step this is.
``up.sql`` file is supposed to have forward step(s), e.g. creating a table.
The ``down.sql`` file should include the corresponding rollback step.