diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..fa7924c --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,16 @@ +{ + "permissions": { + "allow": [ + "Bash(grep -rln *)", + "Bash(grep -nA12 '\\\\[project.optional-dependencies\\\\]\\\\|optional-dependencies\\\\|\\\\[dependency-groups\\\\]' pyproject.toml)", + "Bash(grep -vE \"^$\")", + "Bash(git ls-tree *)", + "Bash(grep -E '\\\\.py$')", + "Bash(grep -v '\\\\.sample$')", + "Bash(git config *)", + "Bash(command -v gh)", + "Bash(gh api *)", + "Bash(python3 -c \"import sys,json; d=json.load\\(sys.stdin\\); print\\('protected:', d.get\\('protected'\\)\\); p=d.get\\('protection',{}\\); print\\('required_pull_request_reviews:', 'yes' if p.get\\('required_pull_request_reviews'\\) else 'no'\\); print\\('enforce_admins:', \\(p.get\\('enforce_admins'\\) or {}\\).get\\('enabled'\\)\\)\")" + ] + } +} diff --git a/README.md b/README.md index 462c65b..8ffa3f5 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,7 @@ authorization and authentication based on a TDEI/Keycloak JWT token (see main.py ## Branch Index -* ```develop``` do your work here -* ```development``` keep this up to date with the "development" environment / dev tag +* ```develop``` merge your work here; keep this up to date with the "development" environment / dev tag * ```staging``` keep this up to date with the "staging" environment / stage tag * ```production``` keep this up to date with the "production" environment / prod tag diff --git a/alembic_task/versions/b3f8a2c91e04_add_auto_flag_review.py b/alembic_task/versions/b3f8a2c91e04_add_auto_flag_review.py index 2aeb46a..f0b39ba 100644 --- a/alembic_task/versions/b3f8a2c91e04_add_auto_flag_review.py +++ b/alembic_task/versions/b3f8a2c91e04_add_auto_flag_review.py @@ -10,6 +10,7 @@ import sqlalchemy as sa from alembic import op +from sqlalchemy import inspect revision: str = "b3f8a2c91e04" down_revision: Union[str, None] = "add6266277c7" @@ -17,7 +18,20 @@ depends_on: Union[str, Sequence[str], None] = None +def _has_column(name: str) -> bool: + """True if `workspaces.` already exists. + + Guards the add/drop so the migration is safe whether or not the column + was created out-of-band (e.g. by a parallel branch) — a plain + ``ADD COLUMN`` would raise ``DuplicateColumnError`` otherwise. + """ + insp = inspect(op.get_bind()) + return name in {c["name"] for c in insp.get_columns("workspaces")} + + def upgrade() -> None: + if _has_column("autoFlagReview"): + return with op.batch_alter_table("workspaces", schema=None) as batch_op: batch_op.add_column( sa.Column( @@ -30,5 +44,7 @@ def upgrade() -> None: def downgrade() -> None: + if not _has_column("autoFlagReview"): + return with op.batch_alter_table("workspaces", schema=None) as batch_op: batch_op.drop_column("autoFlagReview")