From 32b7b475b3bef87caa20e559e9fee589491dcd79 Mon Sep 17 00:00:00 2001
From: Pavel Kirilin <win10@list.ru>
Date: Mon, 6 Sep 2021 11:19:16 +0400
Subject: [PATCH] Updated README for generated project.

Signed-off-by: Pavel Kirilin <win10@list.ru>
---
 .../{{cookiecutter.project_name}}/README.md   | 62 +++++++++++++++++++
 .../pyproject.toml                            |  2 +-
 .../db/migrations/README.md                   |  0
 pyproject.toml                                |  2 +-
 4 files changed, 64 insertions(+), 2 deletions(-)
 delete mode 100644 fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db/migrations/README.md

diff --git a/fastapi_template/template/{{cookiecutter.project_name}}/README.md b/fastapi_template/template/{{cookiecutter.project_name}}/README.md
index 621d8f8..a0ea83d 100644
--- a/fastapi_template/template/{{cookiecutter.project_name}}/README.md
+++ b/fastapi_template/template/{{cookiecutter.project_name}}/README.md
@@ -5,3 +5,65 @@ Start a project with:
 ```
 docker-compose -f deploy/docker-compose.yml --project-directory . up
 ```
+
+## Pre-commit
+
+To install pre-commit simply run inside of the shell:
+```
+pre-commit install
+```
+{%- if cookiecutter.enable_kube == 'True' %}
+
+## Kubernetes
+To run your app in kubernetes
+just run:
+```
+kubectl apply -f deploy/kube
+```
+
+It will create needed components.
+
+If you hasn't pushed to docker registry yet, you can build image locally.
+
+```
+docker-compose -f deploy/docker-compose.yml --project-directory . build
+docker save --output {{cookiecutter.project_name}}.tar {{cookiecutter.project_name}}:latest
+```
+
+{%- endif %}
+{%- if cookiecutter.enable_alembic == 'True' %}
+
+# Migrations
+
+If you want to migrate your database, you should run following commands:
+```bash
+# To run all migrations untill the migration with revision_id.
+alembic upgrade "<revision_id>"
+
+# To perform all pending migrations.
+alembic upgrade "head"
+```
+
+### Reverting migrations
+
+If you want to revert migrations, you should run:
+```bash
+# revert all migrations up to: revision_id.
+alembic downgrade <revision_id>
+
+# Revert everything.
+ alembic downgrade base
+```
+
+### Miration generation
+
+To generate migrations you should run:
+```bash
+# For automatic change detection.
+alembic revision --autogenerate
+
+# For empty file generation.
+alembic revision
+```
+
+{%- endif %}
diff --git a/fastapi_template/template/{{cookiecutter.project_name}}/pyproject.toml b/fastapi_template/template/{{cookiecutter.project_name}}/pyproject.toml
index 7df58b4..1b7d87d 100644
--- a/fastapi_template/template/{{cookiecutter.project_name}}/pyproject.toml
+++ b/fastapi_template/template/{{cookiecutter.project_name}}/pyproject.toml
@@ -19,7 +19,7 @@ yarl = "^1.6.3"
 {%- if cookiecutter.db_info.name != "none" %}
 SQLAlchemy = {version = "^1.4", extras = ["mypy", "asyncio"]}
 {%- endif %}
-{% if cookiecutter.enable_alembic == "True" %}
+{%- if cookiecutter.enable_alembic == "True" %}
 alembic = "^1.6.5"
 {%- endif %}
 {%- if cookiecutter.db_info.name == "postgresql" %}
diff --git a/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db/migrations/README.md b/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db/migrations/README.md
deleted file mode 100644
index e69de29..0000000
diff --git a/pyproject.toml b/pyproject.toml
index 430cd17..e0178ac 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
 [tool.poetry]
 name = "fastapi_template"
-version = "2.2.0"
+version = "2.2.1"
 description = "Feature-rich robust FastAPI template"
 authors = ["Pavel Kirilin <win10@list.ru>"]
 packages = [
-- 
GitLab