lab5: async processing, rabbitmq, worker, outbox, tests and report
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import asyncio
|
||||
|
||||
from sqlalchemy import text
|
||||
from .db import Base, engine
|
||||
|
||||
|
||||
async def main():
|
||||
async with engine.begin() as conn:
|
||||
await conn.execute(text("SELECT pg_advisory_xact_lock(300300)"))
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
|
||||
await conn.execute(text("ALTER TABLE attachments ADD COLUMN IF NOT EXISTS error_code VARCHAR(64)"))
|
||||
|
||||
await conn.execute(text("INSERT INTO schema_versions(version) VALUES (3) ON CONFLICT DO NOTHING"))
|
||||
await conn.execute(text("INSERT INTO schema_versions(version) VALUES (4) ON CONFLICT DO NOTHING"))
|
||||
await conn.execute(text("INSERT INTO schema_versions(version) VALUES (5) ON CONFLICT DO NOTHING"))
|
||||
await engine.dispose()
|
||||
print("Migration 5 applied: outbox, variants and async processing added")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user