Skip to content

Commit 67866e5

Browse files
committed
a
1 parent 7d1f375 commit 67866e5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

botbase/piccolo_migrations/botbase_2023_05_23t00_19_45_350876.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import asyncio
2+
from functools import partial
3+
14
from piccolo.apps.migrations.auto.migration_manager import MigrationManager
25
from piccolo.columns.column_types import BigInt, Integer, Text
36
from piccolo.columns.indexes import IndexMethod
@@ -203,10 +206,15 @@ async def composite_unique() -> None:
203206
class RawTable(Table):
204207
...
205208

206-
await RawTable.raw(
207-
"ALTER TABLE command_log ADD UNIQUE (command, guild, channel, member);"
208-
)
209+
for _ in range(100):
210+
try:
211+
await RawTable.raw(
212+
"ALTER TABLE command_log "
213+
"ADD UNIQUE (command, guild, channel, member);"
214+
)
215+
except Exception:
216+
await asyncio.sleep(0.1)
209217

210-
manager.add_raw(composite_unique)
218+
manager.add_raw(partial(asyncio.create_task, composite_unique()))
211219

212220
return manager

0 commit comments

Comments
 (0)