Question
You have a database named db1. The schema is stored in a Git repository as an SDK-style SQL database project. The repository contains the following GitHub Actions workflow.
```yaml
name: Database CI/CD
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
- name: Build
run: dotnet build db1.sqlproj --configuration Release
- name: Deploy
run: |
SqlPackage /Action:Publish \
/SourceFile:./bin/Release/db1.dacpac \
/TargetConnectionString:"${{ secrets.Target_Connection_String }}"
unit-tests:
runs-on: ubuntu-latest
needs: build-and-deploy
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
- name: Run unit tests
run: dotnet test UnitTests.csproj --configuration Release
```
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.
Explanation
Statement 1 (Yes): A push to main triggers the workflow, and the unit-tests job runs after build-and-deploy because github.ref is refs/heads/main for that push. On a pull request the ref is a pull request ref, so the condition skips the tests there, but that does not affect pushes to main.
Statement 2 (Yes): Building a SQL database project with dotnet build validates the references between objects and the T-SQL syntax against the target platform, and fails the build on errors, before the .dacpac is produced.
Statement 3 (Yes): SqlPackage Publish compares the .dacpac with the target database and, because VerifyDeployment defaults to True, runs a schema validation step before executing the plan. It stops the publish when issues would block deployment or, with BlockOnPossibleDataLoss, when a change could lose data.