This repository has been archived on 2022-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
it-volunteers-for-peace/db/migrations/drop_tables.py

20 lines
432 B
Python
Raw Normal View History

2022-10-14 15:05:04 +00:00
import asyncio
import asyncpg
import os
from asyncpg.connection import Connection
async def drop_tables(connection: Connection):
2022-10-17 10:58:17 +00:00
await connection.execute("DROP TABLE users, tags, categories, projects CASCADE")
2022-10-14 15:05:04 +00:00
async def main():
DB_URL = os.getenv("DB_URL")
connection = await asyncpg.connect(DB_URL)
await drop_tables(connection)
await connection.close()
2022-10-17 10:58:17 +00:00
if __name__ == "__main__":
2022-10-14 15:05:04 +00:00
asyncio.run(main())