add drugs db index
This commit is contained in:
parent
126dcf78c7
commit
ba9e90cd60
7 changed files with 78 additions and 12 deletions
|
|
@ -0,0 +1,36 @@
|
|||
"""add drug index
|
||||
|
||||
Revision ID: 058739dc7aa6
|
||||
Revises: c509dcf806d4
|
||||
Create Date: 2025-08-07 20:30:35.962671
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '058739dc7aa6'
|
||||
down_revision: Union[str, Sequence[str], None] = 'c509dcf806d4'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('drugs', schema=None) as batch_op:
|
||||
batch_op.create_index('ix_drugs_name_dosage_dosage_unit', ['name', 'dosage', 'dosage_unit'], unique=True)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('drugs', schema=None) as batch_op:
|
||||
batch_op.drop_index('ix_drugs_name_dosage_dosage_unit')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
Loading…
Add table
Add a link
Reference in a new issue