An open API service indexing awesome lists of open source software.

https://github.com/colanconnon/apistar_alembic_migrations

Alembic migrations for apistar
https://github.com/colanconnon/apistar_alembic_migrations

alembic apistar migrations python python3

Last synced: 6 months ago
JSON representation

Alembic migrations for apistar

Awesome Lists containing this project

README

          

# Alembic migrations for apistar

### To Install this library

```
pip3 install apistar_alembic_migrations
```

### Register the commands

```
from apistar_alembic_migrations import commands

app = App(
routes=routes,
settings=settings,
commands=commands,
components=sqlalchemy_backend.components
)
```

### To generation the initial migrations structure

```
apistar initialize
```

### The following commands will become avaiable

```
apistar initialize

apistar create_revision "message"

apistar upgrade <"revision id" or Head for latest>

apistar downgrade "revision id"

```

### Enabling auto generating of migrations from models

* open your env.py file in your migrations folder

* find the line that contains
```
target_metadata = None
```

* Import your Declartive Base variable and assign the metadata

```
from app import Base
target_metadata = Base.metadata
```