From 8ca7a7149069f7b95eaf7db08238e8576a856438 Mon Sep 17 00:00:00 2001 From: Ryan Kearsley Date: Thu, 5 Feb 2026 11:10:52 +0000 Subject: [PATCH] Update README --- README.md | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1f8f4f2..15e514b 100644 --- a/README.md +++ b/README.md @@ -49,11 +49,45 @@ Services communicate asynchronously via RabbitMQ message queues. See the Message ## Database Deployment (Test Environments) +If you are deploying to test DROP existing databases before continuing. + +````sql +DECLARE @Databases TABLE (DbName sysname); + +INSERT INTO @Databases (DbName) +VALUES + ('ClusterDb'), + ('DeliusRunningPictureDb'), + ('DeliusStagingDb'), + ('MatchingDb'), + ('OfflocRunningPictureDb'), + ('OfflocStagingDb'), + ('AuditDb'); + +DECLARE @sql nvarchar(max) = N''; + +SELECT @sql += ' +IF EXISTS (SELECT 1 FROM sys.databases WHERE name = ''' + DbName + ''') +BEGIN + ALTER DATABASE [' + DbName + '] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; + DROP DATABASE [' + DbName + ']; +END;' +FROM @Databases; + +EXEC sys.sp_executesql @sql; +```` + The `publish_db.py` script is provided for deploying database projects to test environments. ### Prerequisites -- Python 3 -- .NET SDK with sqlpackage tool installed + +| Requirement | How to check | How to install (bash) | +|------------|-------------|------------------------| +| **Python 3** | `python3 --version` | **macOS (Homebrew)**
`brew install python`

**Ubuntu / Debian**
`sudo apt update && sudo apt install -y python3 python3-pip` | +| **.NET SDK 8.x** | `dotnet --list-sdks` | **macOS (Homebrew)**
`brew install --cask dotnet-sdk@8`

**Ubuntu / Debian**
`sudo apt update && sudo apt install -y dotnet-sdk-8.0` | +| **.NET SDK 10.x** | `dotnet --list-sdks` | **macOS (Homebrew)**
`brew install --cask dotnet-sdk@10`

**Ubuntu / Debian**
`sudo apt update && sudo apt install -y dotnet-sdk-10.0` | +| **sqlpackage (dotnet tool)** | `dotnet tool list -g` | `dotnet tool install -g microsoft.sqlpackage` | + ### Usage 1. **Set required environment variables** before running: