Some work with FastAPI and SQLAlchemy, including automated alembic migrations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

40 lines
932 B

"""baseline
Revision ID: 47ddcb4d3c36
Revises:
Create Date: 2019-07-02 19:49:53.554255
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "47ddcb4d3c36"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"items",
sa.Column("id", sa.Integer, primary_key=True),
sa.Column("title", sa.String(), nullable=False),
sa.Column("description", sa.String()),
sa.Column("owner_id", sa.Integer)
)
op.create_table(
"users",
sa.Column("id", sa.Integer, primary_key=True),
sa.Column("username", sa.String(), nullable=False),
sa.Column("email", sa.String(), nullable=False),
sa.Column("hashed_password", sa.String(), nullable=False),
sa.Column("is_active", sa.Integer)
)
def downgrade():
op.drop_table("items")
op.drop_table("users")