wip
This commit is contained in:
parent
d5abc2ec96
commit
010709a500
2 changed files with 41 additions and 7 deletions
|
|
@ -65,14 +65,15 @@ class HeroRead(HeroBase):
|
||||||
# with config.database.session as session:
|
# with config.database.session as session:
|
||||||
|
|
||||||
if session is None:
|
if session is None:
|
||||||
session = get_config().database.session
|
engine = get_config().database.engine
|
||||||
statement = select(Hero)
|
with Session(engine) as session:
|
||||||
if where != "None" and where is not None:
|
statement = select(Hero)
|
||||||
from sqlmodel import text
|
if where != "None" and where is not None:
|
||||||
|
from sqlmodel import text
|
||||||
|
|
||||||
statement = statement.where(text(where))
|
statement = statement.where(text(where))
|
||||||
statement = statement.offset(offset).limit(limit)
|
statement = statement.offset(offset).limit(limit)
|
||||||
heroes = session.exec(statement).all()
|
heroes = session.exec(statement).all()
|
||||||
return heroes
|
return heroes
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
33
migrations/versions/e26398d96dd0_add_x_y_size.py
Normal file
33
migrations/versions/e26398d96dd0_add_x_y_size.py
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
"""add x, y, size
|
||||||
|
|
||||||
|
Revision ID: e26398d96dd0
|
||||||
|
Revises: a9bb6625c57b
|
||||||
|
Create Date: 2023-06-10 18:37:04.751553
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
import sqlmodel
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'e26398d96dd0'
|
||||||
|
down_revision = 'a9bb6625c57b'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('hero', sa.Column('x', sa.Integer(), nullable=False))
|
||||||
|
op.add_column('hero', sa.Column('y', sa.Integer(), nullable=False))
|
||||||
|
op.add_column('hero', sa.Column('size', sa.Integer(), nullable=False))
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_column('hero', 'size')
|
||||||
|
op.drop_column('hero', 'y')
|
||||||
|
op.drop_column('hero', 'x')
|
||||||
|
# ### end Alembic commands ###
|
||||||
Loading…
Add table
Add a link
Reference in a new issue