This repository was archived by the owner on Jul 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed
Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change 1- FROM mcr.microsoft.com/mssql-tools
1+ FROM mcr.microsoft.com/mssql-tools:latest
22
3- RUN useradd -m -s /bin/bash nonroot
43
54WORKDIR /database
65COPY db-setup-entrypoint.sh /database/
6+ COPY create_database_statement.sql /database/
7+ RUN chmod +x /database/db-setup-entrypoint.sh
78
8- RUN chmod +x /database/db-setup-entrypoint.sh && \
9- chown -R nonroot:nonroot /database
10-
11- USER nonroot
129
1310ENTRYPOINT ["/database/db-setup-entrypoint.sh" ]
11+
Original file line number Diff line number Diff line change 11USE master ;
22GO
33
4+ -- Check if database exists and create it if it doesn't
45IF NOT EXISTS (
56 SELECT name
67 FROM sys .databases
78 WHERE name = N ' ServiceLayer'
89 )
9- CREATE DATABASE [Test];
10+ BEGIN
11+ CREATE DATABASE [ServiceLayer];
12+ END
1013GO
1114
12- IF SERVERPROPERTY (' ProductVersion' ) > ' 12'
15+ USE [ServiceLayer];
16+ GO
17+
18+ -- Only try to set QUERY_STORE if SQL Server version is higher than 12 (SQL 2014)
19+ IF CAST (SERVERPROPERTY (' ProductVersion' ) AS NVARCHAR (128 )) > ' 12'
20+ BEGIN
1321 ALTER DATABASE [ServiceLayer] SET QUERY_STORE = ON ;
22+ END
1423GO
You can’t perform that action at this time.
0 commit comments