README migrations guide

This commit is contained in:
2025-05-28 14:35:36 +03:00
parent e9d4c6365b
commit d9f4a64fe6

View File

@@ -14,9 +14,11 @@ This project is a test web application built using FastAPI, a modern web framewo
### **Installation Instructions** ### **Installation Instructions**
For development:
1. Clone the repository: 1. Clone the repository:
```bash ```bash
git clone https://github.com/yourusername/bookapi.git git clone https://github.com/wowlikon/bookapi.git
``` ```
2. Navigate to the project directory: 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: 4. Build the Docker containers:
```bash ```bash
docker-compose build docker-compose build --no-cache
``` ```
5. Run the application: 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 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** ### **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 | | PUT | `/books/{id}` | Update a specific book by ID |
| DELETE | `/books/{id}` | Delete a specific book by ID | | DELETE | `/books/{id}` | Delete a specific book by ID |
### **Technologies Used** ### **Technologies Used**
- **FastAPI**: A modern web framework for building APIs with Python, known for its speed and ease of use. - **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**: A platform for developing, shipping, and running applications in containers.
- **Docker Compose**: A tool for defining and running multi-container Docker applications. - **Docker Compose**: A tool for defining and running multi-container Docker applications.
### **TODO List** ### **TODO List**
- Split models for API and database - Split models for API and database