🎨 Bring Python code into compliance with Black and Flake8 (#121)
* Ignore Flake8 unused import error F401 https://flake8.readthedocs.io/en/latest/user/error-codes.html The apparently unused imports may be needed for SQLAlchemy. As the code comment says: make sure all SQL Alchemy models are imported before initializing DB otherwise, SQL Alchemy might fail to initialize properly relationships See GitHub 28 and 29 * Ignore Flake8 unused variable error F841 https://flake8.readthedocs.io/en/latest/user/error-codes.html The apparently unused variables may be needed for tests. * Bring line length into compliance with Black Should be 88 characters. * Format alembic code with Black
This commit is contained in:
@@ -67,11 +67,9 @@ def run_migrations_online():
|
||||
|
||||
"""
|
||||
configuration = config.get_section(config.config_ini_section)
|
||||
configuration['sqlalchemy.url'] = get_url()
|
||||
configuration["sqlalchemy.url"] = get_url()
|
||||
connectable = engine_from_config(
|
||||
configuration,
|
||||
prefix="sqlalchemy.",
|
||||
poolclass=pool.NullPool,
|
||||
configuration, prefix="sqlalchemy.", poolclass=pool.NullPool,
|
||||
)
|
||||
|
||||
with connectable.connect() as connection:
|
||||
|
@@ -1,7 +1,7 @@
|
||||
"""First revision
|
||||
|
||||
Revision ID: d4867f3a4c0a
|
||||
Revises:
|
||||
Revises:
|
||||
Create Date: 2019-04-17 13:53:32.978401
|
||||
|
||||
"""
|
||||
@@ -10,7 +10,7 @@ import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd4867f3a4c0a'
|
||||
revision = "d4867f3a4c0a"
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
@@ -18,40 +18,42 @@ depends_on = None
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('user',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('full_name', sa.String(), nullable=True),
|
||||
sa.Column('email', sa.String(), nullable=True),
|
||||
sa.Column('hashed_password', sa.String(), nullable=True),
|
||||
sa.Column('is_active', sa.Boolean(), nullable=True),
|
||||
sa.Column('is_superuser', sa.Boolean(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
op.create_table(
|
||||
"user",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("full_name", sa.String(), nullable=True),
|
||||
sa.Column("email", sa.String(), nullable=True),
|
||||
sa.Column("hashed_password", sa.String(), nullable=True),
|
||||
sa.Column("is_active", sa.Boolean(), nullable=True),
|
||||
sa.Column("is_superuser", sa.Boolean(), nullable=True),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
|
||||
op.create_index(op.f('ix_user_full_name'), 'user', ['full_name'], unique=False)
|
||||
op.create_index(op.f('ix_user_id'), 'user', ['id'], unique=False)
|
||||
op.create_table('item',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('title', sa.String(), nullable=True),
|
||||
sa.Column('description', sa.String(), nullable=True),
|
||||
sa.Column('owner_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['owner_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
op.create_index(op.f("ix_user_email"), "user", ["email"], unique=True)
|
||||
op.create_index(op.f("ix_user_full_name"), "user", ["full_name"], unique=False)
|
||||
op.create_index(op.f("ix_user_id"), "user", ["id"], unique=False)
|
||||
op.create_table(
|
||||
"item",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("title", sa.String(), nullable=True),
|
||||
sa.Column("description", sa.String(), nullable=True),
|
||||
sa.Column("owner_id", sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(["owner_id"], ["user.id"],),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f('ix_item_description'), 'item', ['description'], unique=False)
|
||||
op.create_index(op.f('ix_item_id'), 'item', ['id'], unique=False)
|
||||
op.create_index(op.f('ix_item_title'), 'item', ['title'], unique=False)
|
||||
op.create_index(op.f("ix_item_description"), "item", ["description"], unique=False)
|
||||
op.create_index(op.f("ix_item_id"), "item", ["id"], unique=False)
|
||||
op.create_index(op.f("ix_item_title"), "item", ["title"], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_item_title'), table_name='item')
|
||||
op.drop_index(op.f('ix_item_id'), table_name='item')
|
||||
op.drop_index(op.f('ix_item_description'), table_name='item')
|
||||
op.drop_table('item')
|
||||
op.drop_index(op.f('ix_user_id'), table_name='user')
|
||||
op.drop_index(op.f('ix_user_full_name'), table_name='user')
|
||||
op.drop_index(op.f('ix_user_email'), table_name='user')
|
||||
op.drop_table('user')
|
||||
op.drop_index(op.f("ix_item_title"), table_name="item")
|
||||
op.drop_index(op.f("ix_item_id"), table_name="item")
|
||||
op.drop_index(op.f("ix_item_description"), table_name="item")
|
||||
op.drop_table("item")
|
||||
op.drop_index(op.f("ix_user_id"), table_name="user")
|
||||
op.drop_index(op.f("ix_user_full_name"), table_name="user")
|
||||
op.drop_index(op.f("ix_user_email"), table_name="user")
|
||||
op.drop_table("user")
|
||||
# ### end Alembic commands ###
|
||||
|
Reference in New Issue
Block a user