diff --git a/README.md b/README.md index 3115bb71..4fea298b 100644 --- a/README.md +++ b/README.md @@ -493,6 +493,9 @@ To create the first tier it's similar, you just replace `create_superuser` for ` ### 4.4 Database Migrations +> \[!WARNING\] +> 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. + If you are using the db in docker, you need to change this in `docker-compose.yml` to run migrations: ```sh @@ -737,6 +740,9 @@ class EntityDelete(BaseModel): ### 5.5 Alembic Migrations +> \[!WARNING\] +> 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. + Then, while in the `src` folder, run Alembic migrations: ```sh diff --git a/src/app/core/setup.py b/src/app/core/setup.py index 40701f15..a9c36621 100644 --- a/src/app/core/setup.py +++ b/src/app/core/setup.py @@ -24,10 +24,9 @@ RedisRateLimiterSettings, settings, ) -from .db.database import Base -from .db.database import async_engine as engine +from .db.database import Base, async_engine as engine from .utils import cache, queue, rate_limit - +from ..models import * # -------------- database -------------- async def create_tables() -> None: diff --git a/src/app/models/__init__.py b/src/app/models/__init__.py index e69de29b..c44c105e 100644 --- a/src/app/models/__init__.py +++ b/src/app/models/__init__.py @@ -0,0 +1,4 @@ +from .post import Post +from .rate_limit import RateLimit +from .tier import Tier +from .user import User