Skip to content

Commit

Permalink
Remove unnecessary increment id logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jadmsaadaot committed Jan 12, 2024
1 parent d6e0cfe commit 3355e0f
Showing 1 changed file with 0 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,15 @@ def upgrade():

ministries = sa.table(
'ministries',
sa.Column('id', sa.Integer),
sa.Column('name', sa.String),
sa.column('abbreviation', sa.String),
sa.Column('is_active', sa.Boolean),
sa.Column('is_deleted', sa.Boolean),
sa.Column('sort_order', sa.Integer),
)

## select greatest id from ministries
conn = op.get_bind()
result = conn.execute(
sa.text(
"SELECT max(id) FROM ministries"
)
)
new_id = result.fetchone()[0] + 1

op.execute(
ministries.insert().values(
id=new_id,
name=NoneMinistryName,
abbreviation=NoneMinistryName,
is_active=True,
Expand Down

0 comments on commit 3355e0f

Please sign in to comment.