Skip to content

Commit

Permalink
models.Run: Index the name column
Browse files Browse the repository at this point in the history
Signed-off-by: Zack Cerza <[email protected]>
  • Loading branch information
zmc committed Jul 31, 2023
1 parent 0365ed8 commit b8ed875
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions alembic/versions/266e6f3efd94_index_run_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Index Run.name
Revision ID: 266e6f3efd94
Revises: 11e2594da07b
Create Date: 2023-07-31 12:01:24.936988
"""

# revision identifiers, used by Alembic.
revision = '266e6f3efd94'
down_revision = '11e2594da07b'

from alembic import op


def upgrade():
op.create_index('ix_runs_name', 'runs', ['name'], unique=True)


def downgrade():
op.drop_index('ix_runs_name', table_name='runs')
2 changes: 1 addition & 1 deletion paddles/models/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class Run(Base):

__tablename__ = 'runs'
id = Column(Integer, primary_key=True)
name = Column(String(512), unique=True)
name = Column(String(512), index=True, unique=True)
status = Column(String(16), index=True)
user = Column(String(32), index=True)
scheduled = Column(DateTime, index=True)
Expand Down

0 comments on commit b8ed875

Please sign in to comment.