refactor: rename ScadaLink → ZB.MOM.WW.ScadaBridge (code + projects + namespaces)
Solution + 23 src projects + 26 test projects renamed; folders, csproj, namespaces, and ScadaLinkDbContext/ScadaBridgeDbContext class updated. ActorSystem "scadalink" → "scadabridge", Akka seed-node URLs migrated. SQL roles/logins, LDAP domains, CLI command name, and CLI config dir (~/.scadalink → ~/.scadabridge) also renamed. Build green; 5 Host.Tests fail awaiting SQL login rename in next commit. Pre-existing StaleTagMonitor timing flakes unchanged. Rename script committed at tools/rename-to-scadabridge.sh.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
## Overview
|
||||
|
||||
The test database uses Microsoft SQL Server 2022 Developer Edition running in Docker. It provides two empty databases for ScadaLink — schema creation is handled by EF Core migrations at application startup (dev mode).
|
||||
The test database uses Microsoft SQL Server 2022 Developer Edition running in Docker. It provides two empty databases for ScadaBridge — schema creation is handled by EF Core migrations at application startup (dev mode).
|
||||
|
||||
## Image & Ports
|
||||
|
||||
@@ -14,21 +14,21 @@ The test database uses Microsoft SQL Server 2022 Developer Edition running in Do
|
||||
|
||||
| Account | Username | Password | Purpose |
|
||||
|---------|----------|----------|---------|
|
||||
| SA | `sa` | `ScadaLink_Dev1#` | Server admin (setup only) |
|
||||
| App | `scadalink_app` | `ScadaLink_Dev1#` | Application login (db_owner on both databases) |
|
||||
| SA | `sa` | `ScadaBridge_Dev1#` | Server admin (setup only) |
|
||||
| App | `scadabridge_app` | `ScadaBridge_Dev1#` | Application login (db_owner on both databases) |
|
||||
|
||||
## Databases
|
||||
|
||||
| Database | Purpose |
|
||||
|----------|---------|
|
||||
| `ScadaLinkConfig` | Configuration Database component — templates, deployments, users, audit log |
|
||||
| `ScadaLinkMachineData` | Machine/operational data storage |
|
||||
| `ScadaBridgeConfig` | Configuration Database component — templates, deployments, users, audit log |
|
||||
| `ScadaBridgeMachineData` | Machine/operational data storage |
|
||||
|
||||
Both databases are created by `infra/mssql/setup.sql`. EF Core migrations populate the `ScadaLinkConfig` schema. The `ScadaLinkMachineData` database is seeded with sample tables and stored procedures by `infra/mssql/machinedata_seed.sql`.
|
||||
Both databases are created by `infra/mssql/setup.sql`. EF Core migrations populate the `ScadaBridgeConfig` schema. The `ScadaBridgeMachineData` database is seeded with sample tables and stored procedures by `infra/mssql/machinedata_seed.sql`.
|
||||
|
||||
## Data Persistence
|
||||
|
||||
SQL data is stored in the named Docker volume `scadalink-mssql-data`. Data survives container restarts and `docker compose down`. To reset the database completely:
|
||||
SQL data is stored in the named Docker volume `scadabridge-mssql-data`. Data survives container restarts and `docker compose down`. To reset the database completely:
|
||||
|
||||
```bash
|
||||
docker compose down -v
|
||||
@@ -41,16 +41,16 @@ docker compose up -d
|
||||
After the first `docker compose up -d`, run the setup script:
|
||||
|
||||
```bash
|
||||
docker exec -i scadalink-mssql /opt/mssql-tools18/bin/sqlcmd \
|
||||
-S localhost -U sa -P 'ScadaLink_Dev1#' -C \
|
||||
docker exec -i scadabridge-mssql /opt/mssql-tools18/bin/sqlcmd \
|
||||
-S localhost -U sa -P 'ScadaBridge_Dev1#' -C \
|
||||
-i /docker-entrypoint-initdb.d/setup.sql
|
||||
```
|
||||
|
||||
This creates the databases and the `scadalink_app` login. Then seed the Machine Data database with sample tables, stored procedures, and data:
|
||||
This creates the databases and the `scadabridge_app` login. Then seed the Machine Data database with sample tables, stored procedures, and data:
|
||||
|
||||
```bash
|
||||
docker exec -i scadalink-mssql /opt/mssql-tools18/bin/sqlcmd \
|
||||
-S localhost -U sa -P 'ScadaLink_Dev1#' -C \
|
||||
docker exec -i scadabridge-mssql /opt/mssql-tools18/bin/sqlcmd \
|
||||
-S localhost -U sa -P 'ScadaBridge_Dev1#' -C \
|
||||
-i /docker-entrypoint-initdb.d/machinedata_seed.sql
|
||||
```
|
||||
|
||||
@@ -61,11 +61,11 @@ You only need to run these once (or again after deleting the volume).
|
||||
For `appsettings.Development.json`:
|
||||
|
||||
```
|
||||
Server=localhost,1433;Database=ScadaLinkConfig;User Id=scadalink_app;Password=ScadaLink_Dev1#;TrustServerCertificate=true
|
||||
Server=localhost,1433;Database=ScadaBridgeConfig;User Id=scadabridge_app;Password=ScadaBridge_Dev1#;TrustServerCertificate=true
|
||||
```
|
||||
|
||||
```
|
||||
Server=localhost,1433;Database=ScadaLinkMachineData;User Id=scadalink_app;Password=ScadaLink_Dev1#;TrustServerCertificate=true
|
||||
Server=localhost,1433;Database=ScadaBridgeMachineData;User Id=scadabridge_app;Password=ScadaBridge_Dev1#;TrustServerCertificate=true
|
||||
```
|
||||
|
||||
## Verification
|
||||
@@ -73,23 +73,23 @@ Server=localhost,1433;Database=ScadaLinkMachineData;User Id=scadalink_app;Passwo
|
||||
1. Check the container is running:
|
||||
|
||||
```bash
|
||||
docker ps --filter name=scadalink-mssql
|
||||
docker ps --filter name=scadabridge-mssql
|
||||
```
|
||||
|
||||
2. Query using `sqlcmd` inside the container:
|
||||
|
||||
```bash
|
||||
docker exec -it scadalink-mssql /opt/mssql-tools18/bin/sqlcmd \
|
||||
-S localhost -U sa -P 'ScadaLink_Dev1#' -C \
|
||||
docker exec -it scadabridge-mssql /opt/mssql-tools18/bin/sqlcmd \
|
||||
-S localhost -U sa -P 'ScadaBridge_Dev1#' -C \
|
||||
-Q "SELECT name FROM sys.databases"
|
||||
```
|
||||
|
||||
3. Verify the app login:
|
||||
|
||||
```bash
|
||||
docker exec -it scadalink-mssql /opt/mssql-tools18/bin/sqlcmd \
|
||||
-S localhost -U scadalink_app -P 'ScadaLink_Dev1#' -C \
|
||||
-d ScadaLinkConfig \
|
||||
docker exec -it scadabridge-mssql /opt/mssql-tools18/bin/sqlcmd \
|
||||
-S localhost -U scadabridge_app -P 'ScadaBridge_Dev1#' -C \
|
||||
-d ScadaBridgeConfig \
|
||||
-Q "SELECT DB_NAME()"
|
||||
```
|
||||
|
||||
@@ -112,17 +112,17 @@ python infra/tools/mssql_tool.py check
|
||||
python infra/tools/mssql_tool.py setup --script infra/mssql/setup.sql
|
||||
|
||||
# List tables in a database
|
||||
python infra/tools/mssql_tool.py tables --database ScadaLinkConfig
|
||||
python infra/tools/mssql_tool.py tables --database ScadaBridgeConfig
|
||||
|
||||
# Run an ad-hoc query
|
||||
python infra/tools/mssql_tool.py query --database ScadaLinkConfig --sql "SELECT name FROM sys.tables"
|
||||
python infra/tools/mssql_tool.py query --database ScadaBridgeConfig --sql "SELECT name FROM sys.tables"
|
||||
```
|
||||
|
||||
Use `--host`, `--port`, `--user`, `--password` to override defaults (localhost:1433, sa, ScadaLink_Dev1#). Run with `--help` for full usage.
|
||||
Use `--host`, `--port`, `--user`, `--password` to override defaults (localhost:1433, sa, ScadaBridge_Dev1#). Run with `--help` for full usage.
|
||||
|
||||
## Machine Data Tables & Stored Procedures
|
||||
|
||||
The `machinedata_seed.sql` script creates the following in `ScadaLinkMachineData`:
|
||||
The `machinedata_seed.sql` script creates the following in `ScadaBridgeMachineData`:
|
||||
|
||||
**Tables**:
|
||||
|
||||
@@ -145,13 +145,13 @@ The `machinedata_seed.sql` script creates the following in `ScadaLinkMachineData
|
||||
| `usp_GetEquipmentEvents` | Get recent equipment events with optional filters |
|
||||
| `usp_GetActiveAlarms` | Get active/acknowledged alarms by severity |
|
||||
|
||||
## Relevance to ScadaLink Components
|
||||
## Relevance to ScadaBridge Components
|
||||
|
||||
- **Configuration Database** — primary consumer; EF Core context targets `ScadaLinkConfig`.
|
||||
- **Deployment Manager** — reads/writes deployment records in `ScadaLinkConfig`.
|
||||
- **Template Engine** — reads/writes template definitions in `ScadaLinkConfig`.
|
||||
- **Security & Auth** — user/role data stored in `ScadaLinkConfig`.
|
||||
- **External System Gateway** — scripts use `Database.Connection("machineDataConnection")` to query `ScadaLinkMachineData` tables and stored procedures.
|
||||
- **Configuration Database** — primary consumer; EF Core context targets `ScadaBridgeConfig`.
|
||||
- **Deployment Manager** — reads/writes deployment records in `ScadaBridgeConfig`.
|
||||
- **Template Engine** — reads/writes template definitions in `ScadaBridgeConfig`.
|
||||
- **Security & Auth** — user/role data stored in `ScadaBridgeConfig`.
|
||||
- **External System Gateway** — scripts use `Database.Connection("machineDataConnection")` to query `ScadaBridgeMachineData` tables and stored procedures.
|
||||
- **Site Runtime** — scripts call stored procedures via `Database.Connection()` and `Database.CachedWrite()` for batch recording and data queries.
|
||||
- **Inbound API** — methods can query machine data via named database connections.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user