Skip to content

Commit

Permalink
Consistently use database URI with schema.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielballan committed Oct 1, 2024
1 parent 8f676e8 commit 1987c2b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tiled/commandline/_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ def init(
if not SCHEME_PATTERN.match(database):
# Interpret URI as filepath.
database = f"sqlite+aiosqlite:///{database}"
database = ensure_specified_sql_driver(database)

async def do_setup():
engine = create_async_engine(ensure_specified_sql_driver(database))
engine = create_async_engine(database)
redacted_url = engine.url._replace(password="[redacted]")
try:
await check_database(engine, REQUIRED_REVISION, ALL_REVISIONS)
Expand Down Expand Up @@ -96,8 +97,10 @@ def upgrade_database(
from ..catalog.core import ALL_REVISIONS
from ..utils import ensure_specified_sql_driver

database_uri = ensure_specified_sql_driver(database_uri)

async def do_setup():
engine = create_async_engine(ensure_specified_sql_driver(database_uri))
engine = create_async_engine(database_uri)
redacted_url = engine.url._replace(password="[redacted]")
current_revision = await get_current_revision(engine, ALL_REVISIONS)
await engine.dispose()
Expand Down Expand Up @@ -130,8 +133,10 @@ def downgrade_database(
from ..catalog.core import ALL_REVISIONS
from ..utils import ensure_specified_sql_driver

database_uri = ensure_specified_sql_driver(database_uri)

async def do_setup():
engine = create_async_engine(ensure_specified_sql_driver(database_uri))
engine = create_async_engine(database_uri)
redacted_url = engine.url._replace(password="[redacted]")
current_revision = await get_current_revision(engine, ALL_REVISIONS)
if current_revision is None:
Expand Down

0 comments on commit 1987c2b

Please sign in to comment.