-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uniquely constrained users table (#2483)
* use db constrains for users * lint a bit * coderabbitai * set rate limits for login api * Revert "set rate limits for login api" This reverts commit 78ce40e. * bring checks back * Auto-update of Starter template * Auto-update of NLP template * review suggestions * resolve branching * Auto-update of Starter template * Auto-update of NLP template * lint --------- Co-authored-by: GitHub Actions <[email protected]>
- Loading branch information
1 parent
12d68dd
commit afcaf74
Showing
4 changed files
with
71 additions
and
34 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/zenml/zen_stores/migrations/versions/72675226b2de_unique_users.py
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,31 @@ | ||
"""unique users [72675226b2de]. | ||
Revision ID: 72675226b2de | ||
Revises: 0.55.4 | ||
Create Date: 2024-02-29 14:58:25.584731 | ||
""" | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "72675226b2de" | ||
down_revision = "0.55.4" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
"""Upgrade database schema and/or data, creating a new revision.""" | ||
with op.batch_alter_table("user", schema=None) as batch_op: | ||
batch_op.create_unique_constraint( | ||
"uq_user_name_is_service_account", ["name", "is_service_account"] | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
"""Downgrade database schema and/or data back to the previous revision.""" | ||
with op.batch_alter_table("user", schema=None) as batch_op: | ||
batch_op.drop_constraint( | ||
"uq_user_name_is_service_account", type_="unique" | ||
) |
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
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
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