From 9b060c5fdf0cd3889fb45939bcf3bcae8aa75b06 Mon Sep 17 00:00:00 2001 From: Jason Staack Date: Sat, 14 Mar 2026 10:57:20 -0500 Subject: [PATCH] refactor: rename database from mikrotik to tod in backend code --- backend/alembic.ini | 2 +- .../002_add_routeros_major_version_and_poller_role.py | 4 ++-- backend/app/config.py | 6 +++--- backend/tests/integration/conftest.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/alembic.ini b/backend/alembic.ini index f794886..515c490 100644 --- a/backend/alembic.ini +++ b/backend/alembic.ini @@ -57,7 +57,7 @@ version_path_separator = space # No separator in paths. # are written from script.mako # output_encoding = utf-8 -sqlalchemy.url = postgresql+asyncpg://postgres:postgres@localhost:5432/mikrotik +sqlalchemy.url = postgresql+asyncpg://postgres:postgres@localhost:5432/tod [post_write_hooks] diff --git a/backend/alembic/versions/002_add_routeros_major_version_and_poller_role.py b/backend/alembic/versions/002_add_routeros_major_version_and_poller_role.py index d50c021..9423261 100644 --- a/backend/alembic/versions/002_add_routeros_major_version_and_poller_role.py +++ b/backend/alembic/versions/002_add_routeros_major_version_and_poller_role.py @@ -56,7 +56,7 @@ def upgrade() -> None: $$ """)) - conn.execute(sa.text("GRANT CONNECT ON DATABASE mikrotik TO poller_user")) + conn.execute(sa.text("GRANT CONNECT ON DATABASE tod TO poller_user")) conn.execute(sa.text("GRANT USAGE ON SCHEMA public TO poller_user")) # SELECT on devices only — poller needs to read encrypted_credentials @@ -79,7 +79,7 @@ def downgrade() -> None: pass try: - conn.execute(sa.text("REVOKE CONNECT ON DATABASE mikrotik FROM poller_user")) + conn.execute(sa.text("REVOKE CONNECT ON DATABASE tod FROM poller_user")) except Exception: pass diff --git a/backend/app/config.py b/backend/app/config.py index 181ce85..f9e51d2 100644 --- a/backend/app/config.py +++ b/backend/app/config.py @@ -62,12 +62,12 @@ class Settings(BaseSettings): ENVIRONMENT: str = "dev" # Database - DATABASE_URL: str = "postgresql+asyncpg://postgres:postgres@localhost:5432/mikrotik" + DATABASE_URL: str = "postgresql+asyncpg://postgres:postgres@localhost:5432/tod" # Sync URL used by Alembic only - SYNC_DATABASE_URL: str = "postgresql+psycopg2://postgres:postgres@localhost:5432/mikrotik" + SYNC_DATABASE_URL: str = "postgresql+psycopg2://postgres:postgres@localhost:5432/tod" # App user for RLS enforcement (cannot bypass RLS) - APP_USER_DATABASE_URL: str = "postgresql+asyncpg://app_user:app_password@localhost:5432/mikrotik" + APP_USER_DATABASE_URL: str = "postgresql+asyncpg://app_user:app_password@localhost:5432/tod" # Database connection pool DB_POOL_SIZE: int = 20 diff --git a/backend/tests/integration/conftest.py b/backend/tests/integration/conftest.py index e7b7126..7ead96b 100644 --- a/backend/tests/integration/conftest.py +++ b/backend/tests/integration/conftest.py @@ -41,11 +41,11 @@ from sqlalchemy.ext.asyncio import ( TEST_DATABASE_URL = os.environ.get( "TEST_DATABASE_URL", - "postgresql+asyncpg://postgres:postgres@localhost:5432/mikrotik_test", + "postgresql+asyncpg://postgres:postgres@localhost:5432/tod_test", ) TEST_APP_USER_DATABASE_URL = os.environ.get( "TEST_APP_USER_DATABASE_URL", - "postgresql+asyncpg://app_user:app_password@localhost:5432/mikrotik_test", + "postgresql+asyncpg://app_user:app_password@localhost:5432/tod_test", )