refactor: rename database from mikrotik to tod in backend code
This commit is contained in:
@@ -57,7 +57,7 @@ version_path_separator = space # No separator in paths.
|
|||||||
# are written from script.mako
|
# are written from script.mako
|
||||||
# output_encoding = utf-8
|
# 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]
|
[post_write_hooks]
|
||||||
|
|||||||
@@ -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"))
|
conn.execute(sa.text("GRANT USAGE ON SCHEMA public TO poller_user"))
|
||||||
|
|
||||||
# SELECT on devices only — poller needs to read encrypted_credentials
|
# SELECT on devices only — poller needs to read encrypted_credentials
|
||||||
@@ -79,7 +79,7 @@ def downgrade() -> None:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
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:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -62,12 +62,12 @@ class Settings(BaseSettings):
|
|||||||
ENVIRONMENT: str = "dev"
|
ENVIRONMENT: str = "dev"
|
||||||
|
|
||||||
# Database
|
# 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 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 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
|
# Database connection pool
|
||||||
DB_POOL_SIZE: int = 20
|
DB_POOL_SIZE: int = 20
|
||||||
|
|||||||
@@ -41,11 +41,11 @@ from sqlalchemy.ext.asyncio import (
|
|||||||
|
|
||||||
TEST_DATABASE_URL = os.environ.get(
|
TEST_DATABASE_URL = os.environ.get(
|
||||||
"TEST_DATABASE_URL",
|
"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 = os.environ.get(
|
||||||
"TEST_APP_USER_DATABASE_URL",
|
"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",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user