-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add indexes to tables apikey, flow, and user (#1349)
This pull request adds indexes to the tables apikey, flow, and user in order to improve database performance.
- Loading branch information
Showing
2 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "langflow" | ||
version = "0.6.5a7" | ||
version = "0.6.5a8" | ||
description = "A Python package with a built-in web application" | ||
authors = ["Logspace <[email protected]>"] | ||
maintainers = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
"""empty message | ||
Revision ID: 0b8757876a7c | ||
Revises: 006b3990db50 | ||
Create Date: 2024-01-17 10:32:56.686287 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = '0b8757876a7c' | ||
down_revision: Union[str, None] = '006b3990db50' | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
try: | ||
with op.batch_alter_table('apikey', schema=None) as batch_op: | ||
batch_op.create_index(batch_op.f('ix_apikey_api_key'), ['api_key'], unique=True) | ||
batch_op.create_index(batch_op.f('ix_apikey_name'), ['name'], unique=False) | ||
batch_op.create_index(batch_op.f('ix_apikey_user_id'), ['user_id'], unique=False) | ||
except Exception as e: | ||
print(e) | ||
pass | ||
try: | ||
with op.batch_alter_table('flow', schema=None) as batch_op: | ||
batch_op.create_index(batch_op.f('ix_flow_description'), ['description'], unique=False) | ||
batch_op.create_index(batch_op.f('ix_flow_name'), ['name'], unique=False) | ||
batch_op.create_index(batch_op.f('ix_flow_user_id'), ['user_id'], unique=False) | ||
except Exception as e: | ||
print(e) | ||
pass | ||
|
||
try: | ||
with op.batch_alter_table('user', schema=None) as batch_op: | ||
batch_op.create_index(batch_op.f('ix_user_username'), ['username'], unique=True) | ||
except Exception as e: | ||
print(e) | ||
pass | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
try: | ||
with op.batch_alter_table('user', schema=None) as batch_op: | ||
batch_op.drop_index(batch_op.f('ix_user_username')) | ||
except Exception as e: | ||
print(e) | ||
pass | ||
try: | ||
with op.batch_alter_table('flow', schema=None) as batch_op: | ||
batch_op.drop_index(batch_op.f('ix_flow_user_id')) | ||
batch_op.drop_index(batch_op.f('ix_flow_name')) | ||
batch_op.drop_index(batch_op.f('ix_flow_description')) | ||
except Exception as e: | ||
print(e) | ||
pass | ||
try: | ||
with op.batch_alter_table('apikey', schema=None) as batch_op: | ||
batch_op.drop_index(batch_op.f('ix_apikey_user_id')) | ||
batch_op.drop_index(batch_op.f('ix_apikey_name')) | ||
batch_op.drop_index(batch_op.f('ix_apikey_api_key')) | ||
except Exception as e: | ||
print(e) | ||
pass | ||
# ### end Alembic commands ### |