From d9f4a64fe69fa51f4fcdf069a6165952b9bbf6de Mon Sep 17 00:00:00 2001 From: wowlikon Date: Wed, 28 May 2025 14:35:36 +0300 Subject: [PATCH] README migrations guide --- README.md | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4abeea8..aab5eba 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,11 @@ This project is a test web application built using FastAPI, a modern web framewo ### **Installation Instructions** +For development: + 1. Clone the repository: ```bash - git clone https://github.com/yourusername/bookapi.git + git clone https://github.com/wowlikon/bookapi.git ``` 2. Navigate to the project directory: @@ -31,7 +33,7 @@ This project is a test web application built using FastAPI, a modern web framewo 4. Build the Docker containers: ```bash - docker-compose build + docker-compose build --no-cache ``` 5. Run the application: @@ -39,6 +41,28 @@ This project is a test web application built using FastAPI, a modern web framewo docker-compose up ``` +For make new migrations: + ```bash + docker-compose run --rm api alembic revision --autogenerate -m "Migration name" + ``` + +For apply migrations: + + 1. Build the Docker containers: + ```bash + docker-compose build --no-cache + ``` + + 2. Run database container: + ```bash + docker-compose up -d db + ``` + + 3. Run this command: + ```bash + docker-compose run --rm api alembic upgrade head + ``` + ### **API Endpoints** @@ -58,6 +82,7 @@ This project is a test web application built using FastAPI, a modern web framewo | PUT | `/books/{id}` | Update a specific book by ID | | DELETE | `/books/{id}` | Delete a specific book by ID | + ### **Technologies Used** - **FastAPI**: A modern web framework for building APIs with Python, known for its speed and ease of use. @@ -68,6 +93,7 @@ This project is a test web application built using FastAPI, a modern web framewo - **Docker**: A platform for developing, shipping, and running applications in containers. - **Docker Compose**: A tool for defining and running multi-container Docker applications. + ### **TODO List** - Split models for API and database