refactor: rename database from mikrotik to tod

This commit is contained in:
Jason Staack
2026-03-14 09:55:35 -05:00
parent c7c9f4d71e
commit 64b3cce4b8
5 changed files with 16 additions and 16 deletions

View File

@@ -14,15 +14,15 @@ LOG_LEVEL=debug
DEBUG=true
# Database
POSTGRES_DB=mikrotik
POSTGRES_DB=tod
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
DATABASE_URL=postgresql+asyncpg://postgres:postgres@postgres:5432/mikrotik
SYNC_DATABASE_URL=postgresql+psycopg2://postgres:postgres@postgres:5432/mikrotik
APP_USER_DATABASE_URL=postgresql+asyncpg://app_user:app_password@postgres:5432/mikrotik
DATABASE_URL=postgresql+asyncpg://postgres:postgres@postgres:5432/tod
SYNC_DATABASE_URL=postgresql+psycopg2://postgres:postgres@postgres:5432/tod
APP_USER_DATABASE_URL=postgresql+asyncpg://app_user:app_password@postgres:5432/tod
# Poller database (different role, no RLS)
POLLER_DATABASE_URL=postgres://poller_user:poller_password@postgres:5432/mikrotik
POLLER_DATABASE_URL=postgres://poller_user:poller_password@postgres:5432/tod
# Redis
REDIS_URL=redis://redis:6379/0
@@ -48,7 +48,7 @@ FIRST_ADMIN_PASSWORD=changeme-in-production
# CORS (comma-separated origins)
# Dev: localhost ports for Vite/React dev server
# Prod: set to your actual domain, e.g., https://mikrotik.yourdomain.com
# Prod: set to your actual domain, e.g., https://tod.yourdomain.com
CORS_ORIGINS=http://localhost:3000,http://localhost:5173,http://localhost:8080
# Git store path

View File

@@ -6,16 +6,16 @@ LOG_LEVEL=info
DEBUG=false
# Database
POSTGRES_DB=mikrotik
POSTGRES_DB=tod
POSTGRES_USER=postgres
POSTGRES_PASSWORD=CHANGE_ME_STAGING
DATABASE_URL=postgresql+asyncpg://postgres:CHANGE_ME_STAGING@postgres:5432/mikrotik
SYNC_DATABASE_URL=postgresql+psycopg2://postgres:CHANGE_ME_STAGING@postgres:5432/mikrotik
APP_USER_DATABASE_URL=postgresql+asyncpg://app_user:CHANGE_ME_STAGING@postgres:5432/mikrotik
DATABASE_URL=postgresql+asyncpg://postgres:CHANGE_ME_STAGING@postgres:5432/tod
SYNC_DATABASE_URL=postgresql+psycopg2://postgres:CHANGE_ME_STAGING@postgres:5432/tod
APP_USER_DATABASE_URL=postgresql+asyncpg://app_user:CHANGE_ME_STAGING@postgres:5432/tod
# Poller database (different role, no RLS)
POLLER_DATABASE_URL=postgres://poller_user:poller_password@postgres:5432/mikrotik
POLLER_DATABASE_URL=postgres://poller_user:poller_password@postgres:5432/tod
# Redis
REDIS_URL=redis://redis:6379/0

View File

@@ -65,7 +65,7 @@ services:
environment:
ENVIRONMENT: production
LOG_LEVEL: info
DATABASE_URL: postgres://poller_user:poller_password@postgres:5432/mikrotik
DATABASE_URL: ${POLLER_DATABASE_URL:-postgres://poller_user:poller_password@postgres:5432/tod}
TUNNEL_PORT_MIN: 49000
TUNNEL_PORT_MAX: 49100
TUNNEL_IDLE_TIMEOUT: 300

View File

@@ -18,7 +18,7 @@ services:
container_name: tod_postgres
env_file: .env
environment:
POSTGRES_DB: ${POSTGRES_DB:-mikrotik}
POSTGRES_DB: ${POSTGRES_DB:-tod}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
ports:
@@ -27,7 +27,7 @@ services:
- ./docker-data/postgres:/var/lib/postgresql/data
- ./scripts/init-postgres.sql:/docker-entrypoint-initdb.d/init.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d mikrotik"]
test: ["CMD-SHELL", "pg_isready -U postgres -d ${POSTGRES_DB:-tod}"]
interval: 5s
timeout: 5s
retries: 5

View File

@@ -3,7 +3,7 @@
CREATE ROLE app_user WITH LOGIN PASSWORD 'app_password' NOSUPERUSER NOCREATEDB NOCREATEROLE;
-- Grant connect to the database
GRANT CONNECT ON DATABASE mikrotik TO app_user;
GRANT CONNECT ON DATABASE tod TO app_user;
-- Grant schema usage
GRANT USAGE ON SCHEMA public TO app_user;
@@ -23,7 +23,7 @@ BEGIN
END
$$;
GRANT CONNECT ON DATABASE mikrotik TO poller_user;
GRANT CONNECT ON DATABASE tod TO poller_user;
GRANT USAGE ON SCHEMA public TO poller_user;
-- SELECT grant on devices is applied via Alembic migration 002
-- (after the devices table is created)