Skip to content

Commit

Permalink
Version site_state
Browse files Browse the repository at this point in the history
  • Loading branch information
marksteward committed May 25, 2024
1 parent ba09474 commit 496383b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions migrations/versions/63bdb9d49957_version_site_state.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""Version site state
Revision ID: 63bdb9d49957
Revises: 09f776ea71f0
Create Date: 2024-05-25 10:13:43.911027
"""

# revision identifiers, used by Alembic.
revision = '63bdb9d49957'
down_revision = '09f776ea71f0'

from alembic import op
import sqlalchemy as sa


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('site_state_version',
sa.Column('name', sa.String(), autoincrement=False, nullable=False),
sa.Column('state', sa.String(), autoincrement=False, nullable=True),
sa.Column('transaction_id', sa.BigInteger(), autoincrement=False, nullable=False),
sa.Column('operation_type', sa.SmallInteger(), nullable=False),
sa.PrimaryKeyConstraint('name', 'transaction_id', name=op.f('pk_site_state_version'))
)
op.create_index(op.f('ix_site_state_version_operation_type'), 'site_state_version', ['operation_type'], unique=False)
op.create_index(op.f('ix_site_state_version_transaction_id'), 'site_state_version', ['transaction_id'], unique=False)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_site_state_version_transaction_id'), table_name='site_state_version')
op.drop_index(op.f('ix_site_state_version_operation_type'), table_name='site_state_version')
op.drop_table('site_state_version')
# ### end Alembic commands ###
1 change: 1 addition & 0 deletions models/site_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
class SiteState(BaseModel):
__tablename__ = "site_state"
__export_data__ = False
__versioned__: dict = {}
name = db.Column(db.String, primary_key=True)
state = db.Column(db.String)

Expand Down

0 comments on commit 496383b

Please sign in to comment.