Skip to content

Commit

Permalink
add doc-string
Browse files Browse the repository at this point in the history
  • Loading branch information
vestor-dev committed Nov 25, 2024
1 parent 23ad43b commit e4dbff2
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions web_app/alembic/versions/1a6fada80369_add_postion_columns.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,56 @@
"""add postion columns
"""
Add new columns to the `position` table.
Revision ID: 1a6fada80369
Revises: 0537a9a5e841
Create Date: 2024-11-25 07:34:11.693095
This migration introduces the following changes to the `position` table:
- Adds `is_protection` (Boolean): Indicates whether the position has protection enabled.
- Adds `liquidation_bonus` (Float): Represents any bonus applied during the liquidation process.
- Adds `is_liquidated` (Boolean): Marks whether the position has been liquidated.
- Adds `datetime_liquidation` (DateTime): Stores the timestamp of when the position was liquidated.
These changes enhance the functionality of the `position` table by allowing better tracking of liquidation-related events and attributes.
"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
# Revision identifiers, used by Alembic.
revision = '1a6fada80369'
down_revision = '0537a9a5e841'
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
"""
Apply the upgrade.
This function adds four new columns to the `position` table:
- `is_protection`: A boolean field that indicates whether protection is enabled for the position.
- `liquidation_bonus`: A float field to store any bonuses applied during liquidation.
- `is_liquidated`: A boolean field to indicate if the position has been liquidated.
- `datetime_liquidation`: A datetime field to record when the liquidation occurred.
"""
op.add_column('position', sa.Column('is_protection', sa.Boolean(), nullable=True))
op.add_column('position', sa.Column('liquidation_bonus', sa.Float(), nullable=True))
op.add_column('position', sa.Column('is_liquidated', sa.Boolean(), nullable=True))
op.add_column('position', sa.Column('datetime_liquidation', sa.DateTime(), nullable=False))
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
"""
Revert the upgrade.
This function removes the four columns added to the `position` table:
- `is_protection`
- `liquidation_bonus`
- `is_liquidated`
- `datetime_liquidation`
"""
op.drop_column('position', 'datetime_liquidation')
op.drop_column('position', 'is_liquidated')
op.drop_column('position', 'liquidation_bonus')
op.drop_column('position', 'is_protection')
# ### end Alembic commands ###

0 comments on commit e4dbff2

Please sign in to comment.