We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Typo in migration file
Looking at logs I found a typo in one of the migration files. I don't really know if it is possible to change migration files manually so I'm not writing a pull request but a bug report ;)

https://github.com/Mailu/Mailu/blob/c484c5326b17877bc66a454970cf1342f956d47e/core/admin/migrations/versions/5aeb5811408e_.py#L109

This should probably read relay_table.
Typo in migration file
Looking at logs I found a typo in one of the migration files. I don't really know if it is possible to change migration files manually so I'm not writing a pull request but a bug report ;)

https://github.com/Mailu/Mailu/blob/c484c5326b17877bc66a454970cf1342f956d47e/core/admin/migrations/versions/5aeb5811408e_.py#L109

This should probably read relay_table.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `core/admin/migrations/versions/5aeb5811408e_.py`
Content:
```
1 """ Convert all domains and emails to lowercase
2 
3 Revision ID: 5aeb5811408e
4 Revises: cd79ed46d9c2
5 Create Date: 2018-12-06 16:07:23.380579
6 
7 """
8 
9 # revision identifiers, used by Alembic.
10 revision = '5aeb5811408e'
11 down_revision = 'f1393877871d'
12 
13 from alembic import op, config
14 import sqlalchemy as sa
15 
16 
17 name_column = lambda: sa.Column('name', sa.String(80), primary_key=True)
18 domain_name_column = lambda: sa.Column('domain_name', sa.String(80))
19 user_email_column = lambda: sa.Column('user_email', sa.String(255))
20 email_columns = lambda: [
21     sa.Column('email', sa.String(255), primary_key=True),
22     sa.Column('localpart', sa.String(80)),
23     domain_name_column()
24 ]
25 id_columns = lambda: [
26     sa.Column('id', sa.Integer(), primary_key=True),
27     user_email_column()
28 ]
29 
30 
31 domain_table = sa.Table('domain', sa.MetaData(), name_column())
32 relay_table = sa.Table('relay', sa.MetaData(), name_column())
33 alternative_table = sa.Table('alternative', sa.MetaData(), name_column(), domain_name_column())
34 user_table = sa.Table('user', sa.MetaData(), *email_columns())
35 alias_table = sa.Table('alias', sa.MetaData(), *email_columns())
36 fetch_table = sa.Table('fetch', sa.MetaData(), *id_columns())
37 token_table = sa.Table('token', sa.MetaData(), *id_columns())
38 manager_table = sa.Table('manager', sa.MetaData(), domain_name_column(), user_email_column())
39 
40 
41 def upgrade():
42     connection = op.get_bind()
43 
44     # drop foreign key constraints
45     with op.batch_alter_table('alias') as batch_op:
46         batch_op.drop_constraint('alias_domain_name_fkey', type_='foreignkey')
47     with op.batch_alter_table('alternative') as batch_op:
48         batch_op.drop_constraint('alternative_domain_name_fkey', type_='foreignkey')
49     with op.batch_alter_table('manager') as batch_op:
50         batch_op.drop_constraint('manager_domain_name_fkey', type_='foreignkey')
51         batch_op.drop_constraint('manager_user_email_fkey', type_='foreignkey')
52     with op.batch_alter_table('token') as batch_op:
53         batch_op.drop_constraint('token_user_email_fkey', type_='foreignkey')
54     with op.batch_alter_table('fetch') as batch_op:
55         batch_op.drop_constraint('fetch_user_email_fkey', type_='foreignkey')
56     with op.batch_alter_table('user') as batch_op:
57         batch_op.drop_constraint('user_domain_name_fkey', type_='foreignkey')
58 
59     # lower domain names
60     for domain in connection.execute(domain_table.select()):
61         connection.execute(domain_table.update().where(
62             domain_table.c.name == domain.name
63         ).values(
64             name=domain.name.lower()
65         ))
66     # lower alternatives
67     for alternative in connection.execute(alternative_table.select()):
68         connection.execute(alternative_table.update().where(
69             alternative_table.c.name == alternative.name
70         ).values(
71             name=alternative.name.lower(),
72             domain_name=alternative.domain_name.lower()
73         ))
74     # lower users
75     for user in connection.execute(user_table.select()):
76         connection.execute(user_table.update().where(
77             user_table.c.email == user.email
78         ).values(
79             email=user.email.lower(),
80             localpart=user.localpart.lower(),
81             domain_name=user.domain_name.lower()
82         ))
83     # lower aliases
84     for alias in connection.execute(alias_table.select()):
85         connection.execute(alias_table.update().where(
86             alias_table.c.email == alias.email
87         ).values(
88             email=alias.email.lower(),
89             localpart=alias.localpart.lower(),
90             domain_name=alias.domain_name.lower()
91         ))
92     # lower fetches
93     for fetch in connection.execute(fetch_table.select()):
94         connection.execute(fetch_table.update().where(
95             fetch_table.c.id == fetch.id
96         ).values(
97             user_email=fetch.user_email.lower()
98         ))
99     # lower tokens
100     for token in connection.execute(token_table.select()):
101         connection.execute(token_table.update().where(
102             token_table.c.id == token.id
103         ).values(
104             user_email=token.user_email.lower()
105         ))
106     # lower relays
107     for relay in connection.execute(relay_table.select()):
108         connection.execute(relay_table.update().where(
109             relay_tbale.c.name == relay.name
110         ).values(
111             name=relay.name.lower()
112         ))
113     # lower managers
114     for manager in connection.execute(manager_table.select()):
115         connection.execute(manager_table.update().where(
116             sa.and_(
117                 manager_table.c.domain_name == manager.domain_name,
118                 manager_table.c.user_email == manager.user_email
119             )
120         ).values(
121             domain_name=manager.domain_name.lower(),
122             user_email=manager.user_email.lower()
123         ))
124 
125     # restore foreign key constraints
126     with op.batch_alter_table('alias') as batch_op:
127         batch_op.create_foreign_key('alias_domain_name_fkey', 'domain', ['domain_name'], ['name'])
128     with op.batch_alter_table('user') as batch_op:
129         batch_op.create_foreign_key('user_domain_name_fkey', 'domain', ['domain_name'], ['name'])
130     with op.batch_alter_table('alternative') as batch_op:
131         batch_op.create_foreign_key('alternative_domain_name_fkey', 'domain', ['domain_name'], ['name'])
132     with op.batch_alter_table('manager') as batch_op:
133         batch_op.create_foreign_key('manager_domain_name_fkey', 'domain', ['domain_name'], ['name'])
134         batch_op.create_foreign_key('manager_user_email_fkey', 'user', ['user_email'], ['email'])
135     with op.batch_alter_table('token') as batch_op:
136         batch_op.create_foreign_key('token_user_email_fkey', 'user', ['user_email'], ['email'])
137     with op.batch_alter_table('fetch') as batch_op:
138         batch_op.create_foreign_key('fetch_user_email_fkey', 'user', ['user_email'], ['email'])
139 
140 
141 def downgrade():
142     pass
143
```
--- 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/core/admin/migrations/versions/5aeb5811408e_.py b/core/admin/migrations/versions/5aeb5811408e_.py
--- a/core/admin/migrations/versions/5aeb5811408e_.py
+++ b/core/admin/migrations/versions/5aeb5811408e_.py
@@ -106,7 +106,7 @@
     # lower relays
     for relay in connection.execute(relay_table.select()):
         connection.execute(relay_table.update().where(
-            relay_tbale.c.name == relay.name
+            relay_table.c.name == relay.name
         ).values(
             name=relay.name.lower()
         ))

{"golden_diff": "diff --git a/core/admin/migrations/versions/5aeb5811408e_.py b/core/admin/migrations/versions/5aeb5811408e_.py\n--- a/core/admin/migrations/versions/5aeb5811408e_.py\n+++ b/core/admin/migrations/versions/5aeb5811408e_.py\n@@ -106,7 +106,7 @@\n     # lower relays\n     for relay in connection.execute(relay_table.select()):\n         connection.execute(relay_table.update().where(\n-            relay_tbale.c.name == relay.name\n+            relay_table.c.name == relay.name\n         ).values(\n             name=relay.name.lower()\n         ))\n", "issue": "Typo in migration file\nLooking at logs I found a typo in one of the migration files. I don't really know if it is possible to change migration files manually so I'm not writing a pull request but a bug report ;)\r\n\r\nhttps://github.com/Mailu/Mailu/blob/c484c5326b17877bc66a454970cf1342f956d47e/core/admin/migrations/versions/5aeb5811408e_.py#L109\r\n\r\nThis should probably read relay_table.\nTypo in migration file\nLooking at logs I found a typo in one of the migration files. I don't really know if it is possible to change migration files manually so I'm not writing a pull request but a bug report ;)\r\n\r\nhttps://github.com/Mailu/Mailu/blob/c484c5326b17877bc66a454970cf1342f956d47e/core/admin/migrations/versions/5aeb5811408e_.py#L109\r\n\r\nThis should probably read relay_table.\n", "before_files": [{"content": "\"\"\" Convert all domains and emails to lowercase\n\nRevision ID: 5aeb5811408e\nRevises: cd79ed46d9c2\nCreate Date: 2018-12-06 16:07:23.380579\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '5aeb5811408e'\ndown_revision = 'f1393877871d'\n\nfrom alembic import op, config\nimport sqlalchemy as sa\n\n\nname_column = lambda: sa.Column('name', sa.String(80), primary_key=True)\ndomain_name_column = lambda: sa.Column('domain_name', sa.String(80))\nuser_email_column = lambda: sa.Column('user_email', sa.String(255))\nemail_columns = lambda: [\n    sa.Column('email', sa.String(255), primary_key=True),\n    sa.Column('localpart', sa.String(80)),\n    domain_name_column()\n]\nid_columns = lambda: [\n    sa.Column('id', sa.Integer(), primary_key=True),\n    user_email_column()\n]\n\n\ndomain_table = sa.Table('domain', sa.MetaData(), name_column())\nrelay_table = sa.Table('relay', sa.MetaData(), name_column())\nalternative_table = sa.Table('alternative', sa.MetaData(), name_column(), domain_name_column())\nuser_table = sa.Table('user', sa.MetaData(), *email_columns())\nalias_table = sa.Table('alias', sa.MetaData(), *email_columns())\nfetch_table = sa.Table('fetch', sa.MetaData(), *id_columns())\ntoken_table = sa.Table('token', sa.MetaData(), *id_columns())\nmanager_table = sa.Table('manager', sa.MetaData(), domain_name_column(), user_email_column())\n\n\ndef upgrade():\n    connection = op.get_bind()\n\n    # drop foreign key constraints\n    with op.batch_alter_table('alias') as batch_op:\n        batch_op.drop_constraint('alias_domain_name_fkey', type_='foreignkey')\n    with op.batch_alter_table('alternative') as batch_op:\n        batch_op.drop_constraint('alternative_domain_name_fkey', type_='foreignkey')\n    with op.batch_alter_table('manager') as batch_op:\n        batch_op.drop_constraint('manager_domain_name_fkey', type_='foreignkey')\n        batch_op.drop_constraint('manager_user_email_fkey', type_='foreignkey')\n    with op.batch_alter_table('token') as batch_op:\n        batch_op.drop_constraint('token_user_email_fkey', type_='foreignkey')\n    with op.batch_alter_table('fetch') as batch_op:\n        batch_op.drop_constraint('fetch_user_email_fkey', type_='foreignkey')\n    with op.batch_alter_table('user') as batch_op:\n        batch_op.drop_constraint('user_domain_name_fkey', type_='foreignkey')\n\n    # lower domain names\n    for domain in connection.execute(domain_table.select()):\n        connection.execute(domain_table.update().where(\n            domain_table.c.name == domain.name\n        ).values(\n            name=domain.name.lower()\n        ))\n    # lower alternatives\n    for alternative in connection.execute(alternative_table.select()):\n        connection.execute(alternative_table.update().where(\n            alternative_table.c.name == alternative.name\n        ).values(\n            name=alternative.name.lower(),\n            domain_name=alternative.domain_name.lower()\n        ))\n    # lower users\n    for user in connection.execute(user_table.select()):\n        connection.execute(user_table.update().where(\n            user_table.c.email == user.email\n        ).values(\n            email=user.email.lower(),\n            localpart=user.localpart.lower(),\n            domain_name=user.domain_name.lower()\n        ))\n    # lower aliases\n    for alias in connection.execute(alias_table.select()):\n        connection.execute(alias_table.update().where(\n            alias_table.c.email == alias.email\n        ).values(\n            email=alias.email.lower(),\n            localpart=alias.localpart.lower(),\n            domain_name=alias.domain_name.lower()\n        ))\n    # lower fetches\n    for fetch in connection.execute(fetch_table.select()):\n        connection.execute(fetch_table.update().where(\n            fetch_table.c.id == fetch.id\n        ).values(\n            user_email=fetch.user_email.lower()\n        ))\n    # lower tokens\n    for token in connection.execute(token_table.select()):\n        connection.execute(token_table.update().where(\n            token_table.c.id == token.id\n        ).values(\n            user_email=token.user_email.lower()\n        ))\n    # lower relays\n    for relay in connection.execute(relay_table.select()):\n        connection.execute(relay_table.update().where(\n            relay_tbale.c.name == relay.name\n        ).values(\n            name=relay.name.lower()\n        ))\n    # lower managers\n    for manager in connection.execute(manager_table.select()):\n        connection.execute(manager_table.update().where(\n            sa.and_(\n                manager_table.c.domain_name == manager.domain_name,\n                manager_table.c.user_email == manager.user_email\n            )\n        ).values(\n            domain_name=manager.domain_name.lower(),\n            user_email=manager.user_email.lower()\n        ))\n\n    # restore foreign key constraints\n    with op.batch_alter_table('alias') as batch_op:\n        batch_op.create_foreign_key('alias_domain_name_fkey', 'domain', ['domain_name'], ['name'])\n    with op.batch_alter_table('user') as batch_op:\n        batch_op.create_foreign_key('user_domain_name_fkey', 'domain', ['domain_name'], ['name'])\n    with op.batch_alter_table('alternative') as batch_op:\n        batch_op.create_foreign_key('alternative_domain_name_fkey', 'domain', ['domain_name'], ['name'])\n    with op.batch_alter_table('manager') as batch_op:\n        batch_op.create_foreign_key('manager_domain_name_fkey', 'domain', ['domain_name'], ['name'])\n        batch_op.create_foreign_key('manager_user_email_fkey', 'user', ['user_email'], ['email'])\n    with op.batch_alter_table('token') as batch_op:\n        batch_op.create_foreign_key('token_user_email_fkey', 'user', ['user_email'], ['email'])\n    with op.batch_alter_table('fetch') as batch_op:\n        batch_op.create_foreign_key('fetch_user_email_fkey', 'user', ['user_email'], ['email'])\n\n\ndef downgrade():\n    pass\n", "path": "core/admin/migrations/versions/5aeb5811408e_.py"}], "after_files": [{"content": "\"\"\" Convert all domains and emails to lowercase\n\nRevision ID: 5aeb5811408e\nRevises: cd79ed46d9c2\nCreate Date: 2018-12-06 16:07:23.380579\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '5aeb5811408e'\ndown_revision = 'f1393877871d'\n\nfrom alembic import op, config\nimport sqlalchemy as sa\n\n\nname_column = lambda: sa.Column('name', sa.String(80), primary_key=True)\ndomain_name_column = lambda: sa.Column('domain_name', sa.String(80))\nuser_email_column = lambda: sa.Column('user_email', sa.String(255))\nemail_columns = lambda: [\n    sa.Column('email', sa.String(255), primary_key=True),\n    sa.Column('localpart', sa.String(80)),\n    domain_name_column()\n]\nid_columns = lambda: [\n    sa.Column('id', sa.Integer(), primary_key=True),\n    user_email_column()\n]\n\n\ndomain_table = sa.Table('domain', sa.MetaData(), name_column())\nrelay_table = sa.Table('relay', sa.MetaData(), name_column())\nalternative_table = sa.Table('alternative', sa.MetaData(), name_column(), domain_name_column())\nuser_table = sa.Table('user', sa.MetaData(), *email_columns())\nalias_table = sa.Table('alias', sa.MetaData(), *email_columns())\nfetch_table = sa.Table('fetch', sa.MetaData(), *id_columns())\ntoken_table = sa.Table('token', sa.MetaData(), *id_columns())\nmanager_table = sa.Table('manager', sa.MetaData(), domain_name_column(), user_email_column())\n\n\ndef upgrade():\n    connection = op.get_bind()\n\n    # drop foreign key constraints\n    with op.batch_alter_table('alias') as batch_op:\n        batch_op.drop_constraint('alias_domain_name_fkey', type_='foreignkey')\n    with op.batch_alter_table('alternative') as batch_op:\n        batch_op.drop_constraint('alternative_domain_name_fkey', type_='foreignkey')\n    with op.batch_alter_table('manager') as batch_op:\n        batch_op.drop_constraint('manager_domain_name_fkey', type_='foreignkey')\n        batch_op.drop_constraint('manager_user_email_fkey', type_='foreignkey')\n    with op.batch_alter_table('token') as batch_op:\n        batch_op.drop_constraint('token_user_email_fkey', type_='foreignkey')\n    with op.batch_alter_table('fetch') as batch_op:\n        batch_op.drop_constraint('fetch_user_email_fkey', type_='foreignkey')\n    with op.batch_alter_table('user') as batch_op:\n        batch_op.drop_constraint('user_domain_name_fkey', type_='foreignkey')\n\n    # lower domain names\n    for domain in connection.execute(domain_table.select()):\n        connection.execute(domain_table.update().where(\n            domain_table.c.name == domain.name\n        ).values(\n            name=domain.name.lower()\n        ))\n    # lower alternatives\n    for alternative in connection.execute(alternative_table.select()):\n        connection.execute(alternative_table.update().where(\n            alternative_table.c.name == alternative.name\n        ).values(\n            name=alternative.name.lower(),\n            domain_name=alternative.domain_name.lower()\n        ))\n    # lower users\n    for user in connection.execute(user_table.select()):\n        connection.execute(user_table.update().where(\n            user_table.c.email == user.email\n        ).values(\n            email=user.email.lower(),\n            localpart=user.localpart.lower(),\n            domain_name=user.domain_name.lower()\n        ))\n    # lower aliases\n    for alias in connection.execute(alias_table.select()):\n        connection.execute(alias_table.update().where(\n            alias_table.c.email == alias.email\n        ).values(\n            email=alias.email.lower(),\n            localpart=alias.localpart.lower(),\n            domain_name=alias.domain_name.lower()\n        ))\n    # lower fetches\n    for fetch in connection.execute(fetch_table.select()):\n        connection.execute(fetch_table.update().where(\n            fetch_table.c.id == fetch.id\n        ).values(\n            user_email=fetch.user_email.lower()\n        ))\n    # lower tokens\n    for token in connection.execute(token_table.select()):\n        connection.execute(token_table.update().where(\n            token_table.c.id == token.id\n        ).values(\n            user_email=token.user_email.lower()\n        ))\n    # lower relays\n    for relay in connection.execute(relay_table.select()):\n        connection.execute(relay_table.update().where(\n            relay_table.c.name == relay.name\n        ).values(\n            name=relay.name.lower()\n        ))\n    # lower managers\n    for manager in connection.execute(manager_table.select()):\n        connection.execute(manager_table.update().where(\n            sa.and_(\n                manager_table.c.domain_name == manager.domain_name,\n                manager_table.c.user_email == manager.user_email\n            )\n        ).values(\n            domain_name=manager.domain_name.lower(),\n            user_email=manager.user_email.lower()\n        ))\n\n    # restore foreign key constraints\n    with op.batch_alter_table('alias') as batch_op:\n        batch_op.create_foreign_key('alias_domain_name_fkey', 'domain', ['domain_name'], ['name'])\n    with op.batch_alter_table('user') as batch_op:\n        batch_op.create_foreign_key('user_domain_name_fkey', 'domain', ['domain_name'], ['name'])\n    with op.batch_alter_table('alternative') as batch_op:\n        batch_op.create_foreign_key('alternative_domain_name_fkey', 'domain', ['domain_name'], ['name'])\n    with op.batch_alter_table('manager') as batch_op:\n        batch_op.create_foreign_key('manager_domain_name_fkey', 'domain', ['domain_name'], ['name'])\n        batch_op.create_foreign_key('manager_user_email_fkey', 'user', ['user_email'], ['email'])\n    with op.batch_alter_table('token') as batch_op:\n        batch_op.create_foreign_key('token_user_email_fkey', 'user', ['user_email'], ['email'])\n    with op.batch_alter_table('fetch') as batch_op:\n        batch_op.create_foreign_key('fetch_user_email_fkey', 'user', ['user_email'], ['email'])\n\n\ndef downgrade():\n    pass\n", "path": "core/admin/migrations/versions/5aeb5811408e_.py"}]}