https://github.com/dzsquared/sql-development-tools
Sample code and materials from SQL development session
https://github.com/dzsquared/sql-development-tools
Last synced: 7 months ago
JSON representation
Sample code and materials from SQL development session
- Host: GitHub
- URL: https://github.com/dzsquared/sql-development-tools
- Owner: dzsquared
- License: mit
- Created: 2020-12-12T21:41:21.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-30T00:57:24.000Z (over 5 years ago)
- Last Synced: 2024-12-27T17:20:35.300Z (over 1 year ago)
- Language: TSQL
- Homepage:
- Size: 6.78 MB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: Security/SalesLT.sql
Awesome Lists containing this project
README
# Materials Related to Tools for SQL Development
- [Slide deck for SQL Saturday #1017](Presentation/SQLSaturday1017.pdf)
- [Slide deck for C# SQL Server Conference](Presentation/CSharpCorner.pdf)
**Documentation for SQL Database Projects in Azure Data Studio: [https://aka.ms/azuredatastudio-sqlprojects](https://aka.ms/azuredatastudio-sqlprojects)**
## Getting Started
Fork this repository and clone to your workstation or jump right into remote application development with Codespaces from your fork.
### In Azure Data Studio with Database Projects
After cloning your fork to your local workstation, open `AdventureWorksLT.code-workspace` in Azure Data Studio from the SQL database projects extension.
### In VS Code with .NET Core application
- After cloning your fork to your local workstation, open the folder in VS Code and use the command `Remote Containers: Rebuild and Reopen in Container`, which creates the development containers and deploys the AdventureWorksLT dacpac to the SQL container.
- After forking the repository, create a new Codespace from the repository, which creates the development containers and deploys the AdventureWorksLT dacpac to the SQL container - in GitHub.

## devcontainer Description
This definition creates two containers, one for C# (.NET Core) and one for Microsoft SQL. VS Code will attach to the .NET Core container, and from within that container the Microsoft SQL container will be available on **`localhost`** port 1433. By default, the `sa` user password is `P@ssw0rd`. For more on the configuration of MS SQL, see the section [MS SQL Configuration](#MS-SQL-Configuration)
## MS SQL Configuration
A secondary container for MS SQL is defined in `devcontainer.json` with the Dockerfile and supporting scripts in the `mssql` folder. This container is deployed from the latest developer edition of Microsoft SQL 2019. The database(s) are made available directly in the Codespace/VS Code through the MSSQL extension with a connection labeled "mssql-container". The default `sa` user password is set to `P@ssw0rd`. The default SQL port is mapped to port `1433` in `docker-compose.yml`.
### Changing the sa password
To change the `sa` user password, change the value in `docker-compose.yml` and `devcontainer.json`.
### Database deployment
By default, a blank user database is created titled "ApplicationDB". To add additional database objects or data through T-SQL during Codespace configuration, edit the file `.devcontainer/mssql/setup.sql` or place additional `.sql` files in the `.devcontainer/mssql/` folder. *Large numbers of scripts may take a few minutes following container creation to complete, even when the SQL server is available the database(s) may not be available yet.*
Alternatively, .dacpac files placed in the `./bin/Debug` folder will be published as databases in the container during Codespace configuration. [SqlPackage](https://docs.microsoft.com/sql/tools/sqlpackage) is used to deploy a database schema from a data-tier application file (dacpac), allowing you to bring your application's database structures into the dev container easily. *The publish process may take a few minutes following container creation to complete, even when the server is available the database(s) may not be available yet.*
## License
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See [LICENSE](LICENSE)
Licenses for [SqlPackage](https://docs.microsoft.com/sql/tools/sqlpackage-download), [SQLCMD](https://docs.microsoft.com/sql/linux/sql-server-linux-setup-tools), and [SQL Server Developer Edition](https://go.microsoft.com/fwlink/?linkid=857698).