refactor: Use SQLAlchemyAdapter create_database
Added reusing of sqlalchemy adapters create_database method instead of directly writing code for database creation Refactor #COG-170
This commit is contained in:
parent
c78627f926
commit
d30c337370
1 changed files with 1 additions and 2 deletions
|
|
@ -7,9 +7,8 @@ async def create_db_and_tables():
|
|||
vector_engine = get_vector_engine()
|
||||
|
||||
if vector_config.vector_db_provider == "pgvector":
|
||||
vector_engine.create_database()
|
||||
async with vector_engine.engine.begin() as connection:
|
||||
if len(Base.metadata.tables.keys()) > 0:
|
||||
await connection.run_sync(Base.metadata.create_all)
|
||||
await connection.execute(text("CREATE EXTENSION IF NOT EXISTS vector;"))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue