Moves the six backend projects on disk into Core/ and Hosts/ subfolders, matching the solution folders already defined in Musify.slnx, so the file explorer reflects the same layout as the solution: backend/Core/Musify.Domain backend/Core/Musify.Application backend/Core/Musify.Infrastructure backend/Hosts/Musify.Api backend/Hosts/Musify.Worker backend/Hosts/Musify.StreamingGateway Updates every reference to the old paths: ProjectReference entries in Musify.Api.csproj and Musify.Worker.csproj, the three Dockerfiles, deploy/scripts/migrate.ps1|sh, deploy/zitadel/provision.ps1, deploy/up.ps1, deploy/README.md and docs/development.md. Also fixes a stale Dockerfile comment pointing at a compose file that no longer exists. Verified with `dotnet build Musify.slnx` against the new layout.
29 lines
1.2 KiB
Bash
29 lines
1.2 KiB
Bash
#!/bin/sh
|
|
# Applies the EF Core migrations to the production database from a throwaway SDK
|
|
# container attached to the compose network (Postgres is not published to the host).
|
|
set -eu
|
|
|
|
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
DEPLOY_DIR=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd)
|
|
BACKEND_DIR=$(CDPATH= cd -- "$DEPLOY_DIR/../backend" && pwd)
|
|
ENV_FILE="$DEPLOY_DIR/.env.prod"
|
|
NETWORK=${MUSIFY_NETWORK:-musify-prod_default}
|
|
|
|
. "$SCRIPT_DIR/lib.sh"
|
|
|
|
CONN="Host=postgres;Port=5432;Database=$(env_get "$ENV_FILE" POSTGRES_DB);Username=$(env_get "$ENV_FILE" POSTGRES_USER);Password=$(env_get "$ENV_FILE" POSTGRES_PASSWORD)"
|
|
|
|
# Musify.Infrastructure is both the migrations and the startup project: it owns
|
|
# the IDesignTimeDbContextFactory and the EFCore.Design package.
|
|
docker run --rm \
|
|
--network "$NETWORK" \
|
|
-v "$BACKEND_DIR":/src \
|
|
-w /src/Core/Musify.Infrastructure \
|
|
-e CONN="$CONN" \
|
|
mcr.microsoft.com/dotnet/sdk:10.0 \
|
|
sh -c 'dotnet tool install --global dotnet-ef >/dev/null 2>&1 || true
|
|
export PATH=$PATH:/root/.dotnet/tools
|
|
dotnet restore Musify.Infrastructure.csproj
|
|
dotnet user-secrets set "Database:ConnectionString" "$CONN" >/dev/null
|
|
dotnet ef database update --context Database'
|