-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: nova <[email protected]> Co-authored-by: nova <[email protected]> Co-authored-by: wizzdom <[email protected]>
- Loading branch information
1 parent
e47172c
commit df37984
Showing
8 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
postgres/ | ||
|
||
.vscode/ | ||
.idea/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
services: | ||
bot: | ||
build: . | ||
restart: unless-stopped | ||
depends_on: | ||
- postgres | ||
env_file: | ||
- .env | ||
|
||
postgres: | ||
image: postgres:17-alpine | ||
restart: unless-stopped | ||
ports: | ||
- 5432:5432 | ||
volumes: | ||
- ./postgres:/var/lib/postgresql/data | ||
environment: | ||
- POSTGRES_DB=${DB_NAME} | ||
- POSTGRES_USER=${DB_USER} | ||
- POSTGRES_PASSWORD=${DB_PASSWORD} | ||
|
||
volumes: | ||
postgres: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
aiohttp==3.11.11 | ||
asyncpg==0.30.0 | ||
fortune-python==1.1.1 | ||
hikari==2.1.0 | ||
hikari-arc==1.4.0 | ||
hikari-miru==4.2.0 | ||
pyfiglet==1.0.2 | ||
python-dotenv==1.0.1 | ||
sqlalchemy==2.0.37 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine | ||
from sqlalchemy.ext.declarative import declarative_base | ||
|
||
from src.config import DB_HOST, DB_NAME, DB_PASSWORD, DB_USER | ||
|
||
engine = create_async_engine( | ||
f"postgresql+asyncpg://{DB_USER}:{DB_PASSWORD}@{DB_HOST}/{DB_NAME}", echo=False | ||
) | ||
|
||
|
||
Base = declarative_base() | ||
Session = async_sessionmaker(bind=engine) | ||
|
||
|
||
async def init_db() -> None: | ||
async with engine.begin() as conn: | ||
await conn.run_sync(Base.metadata.create_all) |