Skip to content

Commit 70a71f0

Browse files
authored
Merge pull request #140 from igorbenav/migration-fix
warning plus import for db migrations
2 parents 4c1f9af + d36517a commit 70a71f0

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,9 @@ To create the first tier it's similar, you just replace `create_superuser` for `
493493

494494
### 4.4 Database Migrations
495495

496+
> \[!WARNING\]
497+
> To create the tables if you did not create the endpoints, ensure that you import the models in src/app/models/__init__.py. This step is crucial to create the new tables.
498+
496499
If you are using the db in docker, you need to change this in `docker-compose.yml` to run migrations:
497500

498501
```sh
@@ -737,6 +740,9 @@ class EntityDelete(BaseModel):
737740

738741
### 5.5 Alembic Migrations
739742

743+
> \[!WARNING\]
744+
> To create the tables if you did not create the endpoints, ensure that you import the models in src/app/models/__init__.py. This step is crucial to create the new models.
745+
740746
Then, while in the `src` folder, run Alembic migrations:
741747

742748
```sh

src/app/core/setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@
2424
RedisRateLimiterSettings,
2525
settings,
2626
)
27-
from .db.database import Base
28-
from .db.database import async_engine as engine
27+
from .db.database import Base, async_engine as engine
2928
from .utils import cache, queue, rate_limit
30-
29+
from ..models import *
3130

3231
# -------------- database --------------
3332
async def create_tables() -> None:

src/app/models/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from .post import Post
2+
from .rate_limit import RateLimit
3+
from .tier import Tier
4+
from .user import User

0 commit comments

Comments
 (0)