We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
New bandit failures
```
Test results:
>> Issue: [B113:request_without_timeout] Requests call without timeout
   Severity: Medium   Confidence: Low
   CWE: CWE-400 (https://cwe.mitre.org/data/definitions/400.html)
   More Info: https://bandit.readthedocs.io/en/1.7.5/plugins/b113_request_without_timeout.html
   Location: ./admin/tests/test_integration.py:591:21
590	    )
591	    latest_release = requests.get(github_url).json()
592	    latest_tag = str(latest_release["tag_name"])

--------------------------------------------------
>> Issue: [B113:request_without_timeout] Requests call without timeout
   Severity: Medium   Confidence: Low
   CWE: CWE-400 (https://cwe.mitre.org/data/definitions/400.html)
   More Info: https://bandit.readthedocs.io/en/1.7.5/plugins/b113_request_without_timeout.html
   Location: ./admin/tests/test_integration.py:664:21
663	    )
664	    latest_release = requests.get(github_url).json()
665	    latest_tag = str(latest_release["tag_name"])

--------------------------------------------------
>> Issue: [B608:hardcoded_sql_expressions] Possible SQL injection vector through string-based query construction.
   Severity: Medium   Confidence: Medium
   CWE: CWE-89 (https://cwe.mitre.org/data/definitions/89.html)
   More Info: https://bandit.readthedocs.io/en/1.7.5/plugins/b608_hardcoded_sql_expressions.html
   Location: ./securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py:75:12
74	        result = conn.execute(  # nosec
75	            f"SELECT 1 FROM {table} WHERE journalist_id IS NULL;"
76	        ).first()

--------------------------------------------------
>> Issue: [B608:hardcoded_sql_expressions] Possible SQL injection vector through string-based query construction.
   Severity: Medium   Confidence: Low
   CWE: CWE-89 (https://cwe.mitre.org/data/definitions/89.html)
   More Info: https://bandit.readthedocs.io/en/1.7.5/plugins/b608_hardcoded_sql_expressions.html
   Location: ./securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py:92:16
91	            sa.text(
92	                f"UPDATE OR IGNORE {table} SET journalist_id=:journalist_id "
93	                "WHERE journalist_id IS NULL;"
94	            ).bindparams(journalist_id=deleted_id)

--------------------------------------------------
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py`
Content:
```
1 """make journalist_id non-nullable
2 
3 Revision ID: 2e24fc7536e8
4 Revises: de00920916bf
5 Create Date: 2022-01-12 19:31:06.186285
6 
7 """
8 import os
9 import uuid
10 
11 import argon2
12 import sqlalchemy as sa
13 import two_factor
14 from alembic import op
15 
16 # raise the errors if we're not in production
17 raise_errors = os.environ.get("SECUREDROP_ENV", "prod") != "prod"
18 
19 try:
20     from models import ARGON2_PARAMS
21     from passphrases import PassphraseGenerator
22 except:  # noqa
23     if raise_errors:
24         raise
25 
26 
27 # revision identifiers, used by Alembic.
28 revision = "2e24fc7536e8"
29 down_revision = "de00920916bf"
30 branch_labels = None
31 depends_on = None
32 
33 
34 def generate_passphrase_hash() -> str:
35     passphrase = PassphraseGenerator.get_default().generate_passphrase()
36     return argon2.PasswordHasher(**ARGON2_PARAMS).hash(passphrase)
37 
38 
39 def create_deleted() -> int:
40     """manually insert a "deleted" journalist user.
41 
42     We need to do it this way since the model will reflect the current state of
43     the schema, not what it is at the current migration step
44 
45     It should be basically identical to what Journalist.get_deleted() does
46     """
47     op.execute(
48         sa.text(
49             """\
50         INSERT INTO journalists (uuid, username, session_nonce, passphrase_hash, otp_secret)
51         VALUES (:uuid, "deleted", 0, :passphrase_hash, :otp_secret);
52         """
53         ).bindparams(
54             uuid=str(uuid.uuid4()),
55             passphrase_hash=generate_passphrase_hash(),
56             otp_secret=two_factor.random_base32(),
57         )
58     )
59     # Get the autoincrement ID back
60     conn = op.get_bind()
61     result = conn.execute('SELECT id FROM journalists WHERE username="deleted";').fetchall()
62     return result[0][0]
63 
64 
65 def migrate_nulls() -> None:
66     """migrate existing journalist_id=NULL over to deleted or delete them"""
67     op.execute("DELETE FROM journalist_login_attempt WHERE journalist_id IS NULL;")
68     op.execute("DELETE FROM revoked_tokens WHERE journalist_id IS NULL;")
69     # Look to see if we have data to migrate
70     tables = ("replies", "seen_files", "seen_messages", "seen_replies")
71     needs_migration = []
72     conn = op.get_bind()
73     for table in tables:
74         result = conn.execute(  # nosec
75             f"SELECT 1 FROM {table} WHERE journalist_id IS NULL;"
76         ).first()
77         if result is not None:
78             needs_migration.append(table)
79 
80     if not needs_migration:
81         return
82 
83     deleted_id = create_deleted()
84     for table in needs_migration:
85         # The seen_ tables have UNIQUE(fk_id, journalist_id), so the deleted journalist can only
86         # have seen each item once. It is possible multiple NULL journalist have seen the same thing
87         # so we do this update in two passes.
88         # First we update as many rows to point to the deleted journalist as possible, ignoring any
89         # unique key violations.
90         op.execute(
91             sa.text(
92                 f"UPDATE OR IGNORE {table} SET journalist_id=:journalist_id "
93                 "WHERE journalist_id IS NULL;"
94             ).bindparams(journalist_id=deleted_id)
95         )
96         # Then we delete any leftovers which had been ignored earlier.
97         op.execute(f"DELETE FROM {table} WHERE journalist_id IS NULL")  # nosec
98 
99 
100 def upgrade() -> None:
101     migrate_nulls()
102 
103     with op.batch_alter_table("journalist_login_attempt", schema=None) as batch_op:
104         batch_op.alter_column("journalist_id", existing_type=sa.INTEGER(), nullable=False)
105 
106     with op.batch_alter_table("replies", schema=None) as batch_op:
107         batch_op.alter_column("journalist_id", existing_type=sa.INTEGER(), nullable=False)
108 
109     with op.batch_alter_table("revoked_tokens", schema=None) as batch_op:
110         batch_op.alter_column("journalist_id", existing_type=sa.INTEGER(), nullable=False)
111 
112     with op.batch_alter_table("seen_files", schema=None) as batch_op:
113         batch_op.alter_column("journalist_id", existing_type=sa.INTEGER(), nullable=False)
114 
115     with op.batch_alter_table("seen_messages", schema=None) as batch_op:
116         batch_op.alter_column("journalist_id", existing_type=sa.INTEGER(), nullable=False)
117 
118     with op.batch_alter_table("seen_replies", schema=None) as batch_op:
119         batch_op.alter_column("journalist_id", existing_type=sa.INTEGER(), nullable=False)
120 
121 
122 def downgrade() -> None:
123     # We do not un-migrate the data back to journalist_id=NULL
124 
125     with op.batch_alter_table("seen_replies", schema=None) as batch_op:
126         batch_op.alter_column("journalist_id", existing_type=sa.INTEGER(), nullable=True)
127 
128     with op.batch_alter_table("seen_messages", schema=None) as batch_op:
129         batch_op.alter_column("journalist_id", existing_type=sa.INTEGER(), nullable=True)
130 
131     with op.batch_alter_table("seen_files", schema=None) as batch_op:
132         batch_op.alter_column("journalist_id", existing_type=sa.INTEGER(), nullable=True)
133 
134     with op.batch_alter_table("revoked_tokens", schema=None) as batch_op:
135         batch_op.alter_column("journalist_id", existing_type=sa.INTEGER(), nullable=True)
136 
137     with op.batch_alter_table("replies", schema=None) as batch_op:
138         batch_op.alter_column("journalist_id", existing_type=sa.INTEGER(), nullable=True)
139 
140     with op.batch_alter_table("journalist_login_attempt", schema=None) as batch_op:
141         batch_op.alter_column("journalist_id", existing_type=sa.INTEGER(), nullable=True)
142
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py b/securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py
--- a/securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py
+++ b/securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py
@@ -71,8 +71,8 @@
     needs_migration = []
     conn = op.get_bind()
     for table in tables:
-        result = conn.execute(  # nosec
-            f"SELECT 1 FROM {table} WHERE journalist_id IS NULL;"
+        result = conn.execute(
+            f"SELECT 1 FROM {table} WHERE journalist_id IS NULL;"  # nosec
         ).first()
         if result is not None:
             needs_migration.append(table)
@@ -89,7 +89,7 @@
         # unique key violations.
         op.execute(
             sa.text(
-                f"UPDATE OR IGNORE {table} SET journalist_id=:journalist_id "
+                f"UPDATE OR IGNORE {table} SET journalist_id=:journalist_id "  # nosec
                 "WHERE journalist_id IS NULL;"
             ).bindparams(journalist_id=deleted_id)
         )

{"golden_diff": "diff --git a/securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py b/securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py\n--- a/securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py\n+++ b/securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py\n@@ -71,8 +71,8 @@\n     needs_migration = []\n     conn = op.get_bind()\n     for table in tables:\n-        result = conn.execute(  # nosec\n-            f\"SELECT 1 FROM {table} WHERE journalist_id IS NULL;\"\n+        result = conn.execute(\n+            f\"SELECT 1 FROM {table} WHERE journalist_id IS NULL;\"  # nosec\n         ).first()\n         if result is not None:\n             needs_migration.append(table)\n@@ -89,7 +89,7 @@\n         # unique key violations.\n         op.execute(\n             sa.text(\n-                f\"UPDATE OR IGNORE {table} SET journalist_id=:journalist_id \"\n+                f\"UPDATE OR IGNORE {table} SET journalist_id=:journalist_id \"  # nosec\n                 \"WHERE journalist_id IS NULL;\"\n             ).bindparams(journalist_id=deleted_id)\n         )\n", "issue": "New bandit failures\n```\r\nTest results:\r\n>> Issue: [B113:request_without_timeout] Requests call without timeout\r\n   Severity: Medium   Confidence: Low\r\n   CWE: CWE-400 (https://cwe.mitre.org/data/definitions/400.html)\r\n   More Info: https://bandit.readthedocs.io/en/1.7.5/plugins/b113_request_without_timeout.html\r\n   Location: ./admin/tests/test_integration.py:591:21\r\n590\t    )\r\n591\t    latest_release = requests.get(github_url).json()\r\n592\t    latest_tag = str(latest_release[\"tag_name\"])\r\n\r\n--------------------------------------------------\r\n>> Issue: [B113:request_without_timeout] Requests call without timeout\r\n   Severity: Medium   Confidence: Low\r\n   CWE: CWE-400 (https://cwe.mitre.org/data/definitions/400.html)\r\n   More Info: https://bandit.readthedocs.io/en/1.7.5/plugins/b113_request_without_timeout.html\r\n   Location: ./admin/tests/test_integration.py:664:21\r\n663\t    )\r\n664\t    latest_release = requests.get(github_url).json()\r\n665\t    latest_tag = str(latest_release[\"tag_name\"])\r\n\r\n--------------------------------------------------\r\n>> Issue: [B608:hardcoded_sql_expressions] Possible SQL injection vector through string-based query construction.\r\n   Severity: Medium   Confidence: Medium\r\n   CWE: CWE-89 (https://cwe.mitre.org/data/definitions/89.html)\r\n   More Info: https://bandit.readthedocs.io/en/1.7.5/plugins/b608_hardcoded_sql_expressions.html\r\n   Location: ./securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py:75:12\r\n74\t        result = conn.execute(  # nosec\r\n75\t            f\"SELECT 1 FROM {table} WHERE journalist_id IS NULL;\"\r\n76\t        ).first()\r\n\r\n--------------------------------------------------\r\n>> Issue: [B608:hardcoded_sql_expressions] Possible SQL injection vector through string-based query construction.\r\n   Severity: Medium   Confidence: Low\r\n   CWE: CWE-89 (https://cwe.mitre.org/data/definitions/89.html)\r\n   More Info: https://bandit.readthedocs.io/en/1.7.5/plugins/b608_hardcoded_sql_expressions.html\r\n   Location: ./securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py:92:16\r\n91\t            sa.text(\r\n92\t                f\"UPDATE OR IGNORE {table} SET journalist_id=:journalist_id \"\r\n93\t                \"WHERE journalist_id IS NULL;\"\r\n94\t            ).bindparams(journalist_id=deleted_id)\r\n\r\n--------------------------------------------------\r\n```\n", "before_files": [{"content": "\"\"\"make journalist_id non-nullable\n\nRevision ID: 2e24fc7536e8\nRevises: de00920916bf\nCreate Date: 2022-01-12 19:31:06.186285\n\n\"\"\"\nimport os\nimport uuid\n\nimport argon2\nimport sqlalchemy as sa\nimport two_factor\nfrom alembic import op\n\n# raise the errors if we're not in production\nraise_errors = os.environ.get(\"SECUREDROP_ENV\", \"prod\") != \"prod\"\n\ntry:\n    from models import ARGON2_PARAMS\n    from passphrases import PassphraseGenerator\nexcept:  # noqa\n    if raise_errors:\n        raise\n\n\n# revision identifiers, used by Alembic.\nrevision = \"2e24fc7536e8\"\ndown_revision = \"de00920916bf\"\nbranch_labels = None\ndepends_on = None\n\n\ndef generate_passphrase_hash() -> str:\n    passphrase = PassphraseGenerator.get_default().generate_passphrase()\n    return argon2.PasswordHasher(**ARGON2_PARAMS).hash(passphrase)\n\n\ndef create_deleted() -> int:\n    \"\"\"manually insert a \"deleted\" journalist user.\n\n    We need to do it this way since the model will reflect the current state of\n    the schema, not what it is at the current migration step\n\n    It should be basically identical to what Journalist.get_deleted() does\n    \"\"\"\n    op.execute(\n        sa.text(\n            \"\"\"\\\n        INSERT INTO journalists (uuid, username, session_nonce, passphrase_hash, otp_secret)\n        VALUES (:uuid, \"deleted\", 0, :passphrase_hash, :otp_secret);\n        \"\"\"\n        ).bindparams(\n            uuid=str(uuid.uuid4()),\n            passphrase_hash=generate_passphrase_hash(),\n            otp_secret=two_factor.random_base32(),\n        )\n    )\n    # Get the autoincrement ID back\n    conn = op.get_bind()\n    result = conn.execute('SELECT id FROM journalists WHERE username=\"deleted\";').fetchall()\n    return result[0][0]\n\n\ndef migrate_nulls() -> None:\n    \"\"\"migrate existing journalist_id=NULL over to deleted or delete them\"\"\"\n    op.execute(\"DELETE FROM journalist_login_attempt WHERE journalist_id IS NULL;\")\n    op.execute(\"DELETE FROM revoked_tokens WHERE journalist_id IS NULL;\")\n    # Look to see if we have data to migrate\n    tables = (\"replies\", \"seen_files\", \"seen_messages\", \"seen_replies\")\n    needs_migration = []\n    conn = op.get_bind()\n    for table in tables:\n        result = conn.execute(  # nosec\n            f\"SELECT 1 FROM {table} WHERE journalist_id IS NULL;\"\n        ).first()\n        if result is not None:\n            needs_migration.append(table)\n\n    if not needs_migration:\n        return\n\n    deleted_id = create_deleted()\n    for table in needs_migration:\n        # The seen_ tables have UNIQUE(fk_id, journalist_id), so the deleted journalist can only\n        # have seen each item once. It is possible multiple NULL journalist have seen the same thing\n        # so we do this update in two passes.\n        # First we update as many rows to point to the deleted journalist as possible, ignoring any\n        # unique key violations.\n        op.execute(\n            sa.text(\n                f\"UPDATE OR IGNORE {table} SET journalist_id=:journalist_id \"\n                \"WHERE journalist_id IS NULL;\"\n            ).bindparams(journalist_id=deleted_id)\n        )\n        # Then we delete any leftovers which had been ignored earlier.\n        op.execute(f\"DELETE FROM {table} WHERE journalist_id IS NULL\")  # nosec\n\n\ndef upgrade() -> None:\n    migrate_nulls()\n\n    with op.batch_alter_table(\"journalist_login_attempt\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=False)\n\n    with op.batch_alter_table(\"replies\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=False)\n\n    with op.batch_alter_table(\"revoked_tokens\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=False)\n\n    with op.batch_alter_table(\"seen_files\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=False)\n\n    with op.batch_alter_table(\"seen_messages\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=False)\n\n    with op.batch_alter_table(\"seen_replies\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=False)\n\n\ndef downgrade() -> None:\n    # We do not un-migrate the data back to journalist_id=NULL\n\n    with op.batch_alter_table(\"seen_replies\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=True)\n\n    with op.batch_alter_table(\"seen_messages\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=True)\n\n    with op.batch_alter_table(\"seen_files\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=True)\n\n    with op.batch_alter_table(\"revoked_tokens\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=True)\n\n    with op.batch_alter_table(\"replies\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=True)\n\n    with op.batch_alter_table(\"journalist_login_attempt\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=True)\n", "path": "securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py"}], "after_files": [{"content": "\"\"\"make journalist_id non-nullable\n\nRevision ID: 2e24fc7536e8\nRevises: de00920916bf\nCreate Date: 2022-01-12 19:31:06.186285\n\n\"\"\"\nimport os\nimport uuid\n\nimport argon2\nimport sqlalchemy as sa\nimport two_factor\nfrom alembic import op\n\n# raise the errors if we're not in production\nraise_errors = os.environ.get(\"SECUREDROP_ENV\", \"prod\") != \"prod\"\n\ntry:\n    from models import ARGON2_PARAMS\n    from passphrases import PassphraseGenerator\nexcept:  # noqa\n    if raise_errors:\n        raise\n\n\n# revision identifiers, used by Alembic.\nrevision = \"2e24fc7536e8\"\ndown_revision = \"de00920916bf\"\nbranch_labels = None\ndepends_on = None\n\n\ndef generate_passphrase_hash() -> str:\n    passphrase = PassphraseGenerator.get_default().generate_passphrase()\n    return argon2.PasswordHasher(**ARGON2_PARAMS).hash(passphrase)\n\n\ndef create_deleted() -> int:\n    \"\"\"manually insert a \"deleted\" journalist user.\n\n    We need to do it this way since the model will reflect the current state of\n    the schema, not what it is at the current migration step\n\n    It should be basically identical to what Journalist.get_deleted() does\n    \"\"\"\n    op.execute(\n        sa.text(\n            \"\"\"\\\n        INSERT INTO journalists (uuid, username, session_nonce, passphrase_hash, otp_secret)\n        VALUES (:uuid, \"deleted\", 0, :passphrase_hash, :otp_secret);\n        \"\"\"\n        ).bindparams(\n            uuid=str(uuid.uuid4()),\n            passphrase_hash=generate_passphrase_hash(),\n            otp_secret=two_factor.random_base32(),\n        )\n    )\n    # Get the autoincrement ID back\n    conn = op.get_bind()\n    result = conn.execute('SELECT id FROM journalists WHERE username=\"deleted\";').fetchall()\n    return result[0][0]\n\n\ndef migrate_nulls() -> None:\n    \"\"\"migrate existing journalist_id=NULL over to deleted or delete them\"\"\"\n    op.execute(\"DELETE FROM journalist_login_attempt WHERE journalist_id IS NULL;\")\n    op.execute(\"DELETE FROM revoked_tokens WHERE journalist_id IS NULL;\")\n    # Look to see if we have data to migrate\n    tables = (\"replies\", \"seen_files\", \"seen_messages\", \"seen_replies\")\n    needs_migration = []\n    conn = op.get_bind()\n    for table in tables:\n        result = conn.execute(\n            f\"SELECT 1 FROM {table} WHERE journalist_id IS NULL;\"  # nosec\n        ).first()\n        if result is not None:\n            needs_migration.append(table)\n\n    if not needs_migration:\n        return\n\n    deleted_id = create_deleted()\n    for table in needs_migration:\n        # The seen_ tables have UNIQUE(fk_id, journalist_id), so the deleted journalist can only\n        # have seen each item once. It is possible multiple NULL journalist have seen the same thing\n        # so we do this update in two passes.\n        # First we update as many rows to point to the deleted journalist as possible, ignoring any\n        # unique key violations.\n        op.execute(\n            sa.text(\n                f\"UPDATE OR IGNORE {table} SET journalist_id=:journalist_id \"  # nosec\n                \"WHERE journalist_id IS NULL;\"\n            ).bindparams(journalist_id=deleted_id)\n        )\n        # Then we delete any leftovers which had been ignored earlier.\n        op.execute(f\"DELETE FROM {table} WHERE journalist_id IS NULL\")  # nosec\n\n\ndef upgrade() -> None:\n    migrate_nulls()\n\n    with op.batch_alter_table(\"journalist_login_attempt\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=False)\n\n    with op.batch_alter_table(\"replies\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=False)\n\n    with op.batch_alter_table(\"revoked_tokens\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=False)\n\n    with op.batch_alter_table(\"seen_files\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=False)\n\n    with op.batch_alter_table(\"seen_messages\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=False)\n\n    with op.batch_alter_table(\"seen_replies\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=False)\n\n\ndef downgrade() -> None:\n    # We do not un-migrate the data back to journalist_id=NULL\n\n    with op.batch_alter_table(\"seen_replies\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=True)\n\n    with op.batch_alter_table(\"seen_messages\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=True)\n\n    with op.batch_alter_table(\"seen_files\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=True)\n\n    with op.batch_alter_table(\"revoked_tokens\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=True)\n\n    with op.batch_alter_table(\"replies\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=True)\n\n    with op.batch_alter_table(\"journalist_login_attempt\", schema=None) as batch_op:\n        batch_op.alter_column(\"journalist_id\", existing_type=sa.INTEGER(), nullable=True)\n", "path": "securedrop/alembic/versions/2e24fc7536e8_make_journalist_id_non_nullable.py"}]}