update docs for db init and migrations

This commit is contained in:
collerek
2020-10-26 10:09:10 +01:00
parent 085777e346
commit 5e44093e2d

View File

@ -59,6 +59,17 @@ as `response_model` and as a requests parameters.
Here you have a sample test that will prove that everything works as intended. Here you have a sample test that will prove that everything works as intended.
Be sure to create the tables first. If you are using pytest you can use a fixture.
```python
@pytest.fixture(autouse=True, scope="module")
def create_test_database():
engine = sqlalchemy.create_engine(DATABASE_URL)
metadata.create_all(engine)
yield
metadata.drop_all(engine)
```
```python ```python
# here is a sample test to check the working of the ormar with fastapi # here is a sample test to check the working of the ormar with fastapi