1) Remove migrations folder from the exclude list of .pycodestyle file.

2) Fixed all the PEP8 issues in the migration files.
pull/8824/head
Akshay Joshi 2025-06-04 12:36:42 +05:30
parent db5943bd8f
commit c2ef9d06ca
9 changed files with 42 additions and 17 deletions

View File

@ -6,4 +6,4 @@ show-source = False
show-pep8 = False
count = True
format = pylint
exclude = migrations,node_modules,config_local.py,config_distro.py
exclude = node_modules,config_local.py,config_distro.py

View File

@ -20,6 +20,7 @@ Bundled PostgreSQL Utilities
New features
************
| `Issue #1926 <https://github.com/pgadmin-org/pgadmin4/issues/1926>`_ - Add a new permission to allow disabling "Change Password" feature for a pgAdmin role.
| `Issue #8665 <https://github.com/pgadmin-org/pgadmin4/issues/8665>`_ - Supports JSON logging for gunicorn process within Docker.
Housekeeping

View File

@ -39,7 +39,8 @@ def upgrade():
meta.reflect(op.get_bind(), only=('role',))
role_table = sa.Table('role', meta)
from pgadmin.tools.user_management.PgAdminPermissions import AllPermissionTypes
from pgadmin.tools.user_management.PgAdminPermissions import (
AllPermissionTypes)
op.execute(
role_table.update().where(role_table.c.name == 'User')
.values(permissions=",".join(AllPermissionTypes.list())))

View File

@ -26,8 +26,9 @@ depends_on = None
def upgrade():
with op.batch_alter_table("server",
table_kwargs={'sqlite_autoincrement': True}) as batch_op:
with (op.batch_alter_table("server",
table_kwargs={'sqlite_autoincrement': True})
as batch_op):
if context.get_impl().bind.dialect.name == "sqlite":
batch_op.alter_column('id', autoincrement=True)
batch_op.add_column(sa.Column('is_adhoc', sa.Integer(),

View File

@ -49,6 +49,7 @@ def upgrade():
table.update().values(prepare_threshold=5)
)
def downgrade():
# pgAdmin only upgrades, downgrade not implemented.
pass

View File

@ -35,7 +35,8 @@ def upgrade():
qt_open_tab_setting = session.query(Preferences).filter_by(
name='new_browser_tab').order_by(Preferences.id.desc()).first()
debugger_tab_setting = session.query(Preferences).filter_by(
name='debugger_new_browser_tab').order_by(Preferences.id.desc()).first()
name='debugger_new_browser_tab').order_by(
Preferences.id.desc()).first()
schema_diff_tab_setting = session.query(Preferences).filter_by(
name='schema_diff_new_browser_tab').order_by(
Preferences.id.desc()).first()

View File

@ -33,7 +33,8 @@ def upgrade():
"server", table_kwargs={'sqlite_autoincrement': True}) as batch_op:
if context.get_impl().bind.dialect.name == "sqlite":
batch_op.alter_column('id', autoincrement=True)
batch_op.add_column(sa.Column('shared_username', sa.String(64), nullable=True))
batch_op.add_column(sa.Column('shared_username', sa.String(64),
nullable=True))
def downgrade():

View File

@ -1,5 +1,12 @@
"""empty message
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2025, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
"""
Revision ID: ac2c2e27dc2d
Revises: ec0f11f9a4e6
@ -20,11 +27,11 @@ depends_on = None
def upgrade():
session = Session(bind=op.get_bind())
session.query(Preferences).filter(
Preferences.name == 'execute_query').update({'name': 'execute_script'})
Preferences.name == 'execute_query').update({'name': 'execute_script'})
session.commit()
meta = sa.MetaData()
meta.reflect(op.get_bind(), only=('user_macros',))
user_macros_table = sa.Table('user_macros', meta)
@ -37,7 +44,7 @@ def upgrade():
)
# Fetch the data from the user_macros table
results = op.get_bind().execute(stmt).fetchall()
# Drop and re-create user macro table.
op.drop_table('user_macros')
op.create_table(
@ -47,8 +54,10 @@ def upgrade():
sa.Column('uid', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=1024), nullable=False),
sa.Column('sql', sa.String()),
sa.ForeignKeyConstraint(['mid'], ['macros.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['uid'], ['user.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['mid'], ['macros.id'],
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['uid'], ['user.id'],
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id',))
# Reflect the new table structure
@ -64,6 +73,7 @@ def upgrade():
]
)
def downgrade():
# pgAdmin only upgrades, downgrade not implemented.
pass

View File

@ -1,5 +1,12 @@
"""empty message
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2025, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
"""
Revision ID: c62bcc14c3d6
Revises: 1f0eddc8fc79
@ -15,6 +22,7 @@ down_revision = '1f0eddc8fc79'
branch_labels = None
depends_on = None
def upgrade():
# Add 'change_password' permission to all roles except 'Administrator'.
meta = sa.MetaData()
@ -26,12 +34,13 @@ def upgrade():
(role_table.c.name != 'Administrator')
).values(
permissions=sa.case(
(perm == None, 'change_password'),
(perm.is_(None), 'change_password'),
(perm == '', 'change_password'),
else_=perm + ',change_password'
))
)
def downgrade():
# pgAdmin only upgrades, downgrade not implemented.
pass