refactor: rename database from mikrotik to tod in backend code

This commit is contained in:
Jason Staack
2026-03-14 10:57:20 -05:00
parent b2ea6f0d76
commit 9b060c5fdf
4 changed files with 8 additions and 8 deletions

View File

@@ -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]

View File

@@ -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

View File

@@ -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

View File

@@ -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",
)