|
5 | 5 |
|
6 | 6 | ## Overview |
7 | 7 |
|
8 | | -> This project demonstrates how to automate database development with |
9 | | - [dacpac](https://learn.microsoft.com/en-us/sql/relational-databases/data-tier-applications/data-tier-applications?view=sql-server-ver16) |
10 | | -to an Azure SQL Database using a GitHub Actions. |
| 8 | +> This project demonstrates how to automate database development with 'microsoft.sqlpackage' to an Azure SQL Database using a GitHub Actions. |
11 | 9 |
|
12 | 10 |
|
13 | | -## Flow |
| 11 | +## Flow |
14 | 12 |
|
15 | | -1. Database Project build |
16 | | -2. DacPack file is created |
17 | | -3. Contents of dacpac is consumed by Github Action |
18 | | -4. Deploy against a database |
| 13 | +1. Build SQL server objects (tables, views, and instance objects) |
| 14 | +2. Dacpack file is created |
| 15 | +3. Contents of dacpac is consumed by Github Actions |
| 16 | +4. Deploy against a SQL database |
19 | 17 |
|
20 | 18 |
|
21 | 19 | ## Prerequisites |
22 | 20 | - Azure Subscription |
23 | 21 |
|
24 | 22 | ## Setup |
25 | 23 | 1. Create a new Azure Service Principal |
26 | | -2. Create a new Azure SQL Database, see infra [README.md](../infra/README.md) for more details. |
| 24 | +2. Create a new Azure SQL Database, see infra [Makefile](./infra/Makefile) for more details. |
27 | 25 |
|
28 | 26 | ## Configuration |
29 | 27 | 1. Add the following secrets to your GitHub repository: |
30 | | - - `AZURE_SQL_CONNECTION_STRING` - Azure SQL Database connection string |
| 28 | + - `AZURE_SQL_CONNECTION_STRING` - Azure SQL Database connection string of your choice |
31 | 29 |
|
32 | 30 | ## Azure Deployment |
33 | | -See [deploy.yml](.github/workflows/deploy.yml) |
| 31 | +1. Run database deployment from github actions tab. See [deploy.yml](.github/workflows/deploy.yml) |
34 | 32 |
|
35 | 33 |
|
36 | | -## Resources |
37 | | -- https://github.com/microsoft/DacFx?tab=readme-ov-file#-create-a-sql-project |
38 | | -- https://learn.microsoft.com/en-gb/sql/tools/sqlpackage/sqlpackage?view=sql-server-ver16 |
39 | | -- https://learn.microsoft.com/en-us/sql/relational-databases/data-tier-applications/data-tier-applications?view=sql-server-ver16 |
40 | | -- https://www.nuget.org/packages/microsoft.build.sql/ |
| 34 | +## Local development environment |
| 35 | +To run sql project in Docker, follow these steps: |
| 36 | + |
| 37 | +1. Build and start the necessary containers |
| 38 | +```bash |
| 39 | +make docker |
| 40 | +``` |
| 41 | + |
| 42 | +2. Examine the logs |
| 43 | +```bash |
| 44 | +docker compose logs -f sqlpackage |
| 45 | +``` |
0 commit comments