Skip to content

Commit

Permalink
Update 4 files
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiiRepair committed Oct 9, 2023
1 parent 6b46f01 commit 983356c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@

engine = db.create_engine(
f"postgresql://{_POSTGRES_USER}:{_POSTGRES_PASSWORD}@{_POSTGRES_HOST}:{POSTGRES_PORT}/{_POSTGRES_DB}"
, echo=True
)
conn = _engine.connect()
db_metadata = db.MetaData()

# ------------------------------------------------------------------------------

Expand Down
13 changes: 7 additions & 6 deletions bot/db/tables.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import sqlalchemy as db
from bot import db_metadata

Groups = db.Table(
"Groups",
_metadata,
db.Column("id", db.Integer(), primary_key=True),
db.Column("chat_id", db.String(255), nullable=False),
db.Column("Major", db.String(255), default="Math"),
db.Column("Pass", db.Boolean(), default=True),
"Groups",
db_metadata,
db.Column("id", db.Integer(), primary_key=True),
db.Column("chat_id", db.String(255), nullable=False),
db.Column("Major", db.String(255), default="Math"),
db.Column("Pass", db.Boolean(), default=True),
)
1 change: 1 addition & 0 deletions bot/models/postgres/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from sqlalchemy.orm import relationship
3 changes: 3 additions & 0 deletions bot/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pathlib import Path
from termcolor import colored


async def setup_db():
_metadata = db.MetaData()

Expand All @@ -19,6 +20,8 @@ async def setup_db():
)

metadata.create_all(engine)


async def setup_plugins():
cwd = os.path.dirname(os.path.abspath(__file__))
folders = ["callbacks", "tasks"]
Expand Down

0 comments on commit 983356c

Please sign in to comment.