Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
armanddidierjean committed Apr 12, 2024
1 parent 54f3dc8 commit c3bd626
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,38 @@ POSTGRES_DB = "hyperion"
uvicorn app.main:app --reload
```

## Use Alembic migrations

The project use Alembic migrations to manage database structure evolutions.

When the database does not exist, SQLAlchemy will create a new database with an up to date structure. When the database already exist, migrations must be run to update the structure.

### Run migrations

These [migration files](./migrations/versions/) are automatically run before Hyperion startup.

They can also be run manually using the following command:

```bash
alembic upgrade head
```

> If you want to force Alembic to consider your database structure is up to date, you can use the following command:
>
> ```bash
> alembic stamp head
> ```
### Write migration files
To create a new migration file, use the following command:
```bash
alembic revision --autogenerate -m "Your message"
```
Files must be names with the following convention: `number-message.py

## OpenAPI specification

API endpoints are parsed following the OpenAPI specifications at `http://127.0.0.1:8000/openapi.json`.
Expand Down

0 comments on commit c3bd626

Please sign in to comment.