Alembic is used to migrate the databases. [link](https://alembic.sqlalchemy.org/en/latest/front.html#installation)

# How to

Requirements:
1. Set credentials for Azure authentication towards the postgres database.
   Credential types are controlled by `ISAR_ALLOWED_AUTH_METHODS`, a
   comma-separated list of `WorkloadIdentity` (federated token in AKS) and/or
   `ClientSecret` (reads `ISAR_AZURE_CLIENT_SECRET`). Order sets priority in
   the resulting `ChainedTokenCredential`. Default is `ClientSecret`, which
   `alembic env.py` uses locally.

<details>
<summary>
Creating new migrations
</summary>

```bash
alembic revision --autogenerate -m "Migration name"
```

This will compare what is in the metadata of sqlalchemy Base with what is in the database and create a migration for it. 
</details>

<details open>
<summary>
Checking if database is up-to-date
</summary>

```bash
alembic check
```
</details>

<details>
<summary>
Run migrations
</summary>

```bash
alembic upgrade head
```
</details>


# Notes:
1. The model files are located [here](../src/isar/services/service_connections/persistent_memory.py). 
