-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
937e7f6
commit 8f51518
Showing
1 changed file
with
13 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
import asyncio | ||
|
||
from sqlalchemy import text | ||
from sqlalchemy.ext.asyncio import AsyncSession | ||
|
||
from src.db.session import async_session | ||
|
||
async def create_pg_extensions() -> None: | ||
async with async_session() as session: | ||
await session.execute(text('create EXTENSION if not EXISTS "pgcrypto"')) | ||
await session.execute(text('create EXTENSION if not EXISTS "hstore"')) | ||
await session.commit() | ||
|
||
if __name__ == "__main__": | ||
asyncio.run(create_pg_extensions()) | ||
|
||
|
||
async def create_pg_extensions(session: AsyncSession) -> None: | ||
await session.execute(text('create EXTENSION if not EXISTS "pgcrypto"')) | ||
await session.execute(text('create EXTENSION if not EXISTS "hstore"')) | ||
await session.commit() |