# Migration

## v1 -> v2

In v2 the database is now managed with Tortoise-ORM and aerich.

### Steps

* Backup the database. There are a number of ways you can do this, the easiest is `pg_dump`
* Pull the latest `v1.x` tag, check that tag and then run the bot. **This step is vital to avoid data loss**.
* Pull v2.x tag from the repository then check it out.
* In the database uri in `config.py` replace `postgresql` with `postgres`
* Update packages with `pipenv install`
* Run `aerich update` in the root of the repo.
* Run the bot as normal.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.message.anothercat.me/dependabot-pip-mypy-0.901/self-hosting/migration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
