Merge branch 'jodebrui'

This commit is contained in:
Jos de Bruijn
2016-06-07 15:48:22 -07:00
6 changed files with 87 additions and 49 deletions
+2 -1
View File
@@ -20,4 +20,5 @@ samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateA
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Release/DemoWorkload.FrmConfig.resources
samples/features/in-memory/ticket-reservations/DemoWorkload/bin/Release/DemoWorkload.vshost.exe.config
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Debug/PopulateAlwaysEncryptedData.csproj.FileListAbsolute.txt
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.vshost.exe.config
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.vshost.exe.config
*.zip
@@ -82,7 +82,9 @@ DECLARE @PrimaryKeyColumn nvarchar(max) = N'';
SET @SQL = N'';
SET @SQL += N'USE master;' + @CrLf + @CrLf
-- when not using Azure DB, add create database statement
IF SERVERPROPERTY('EngineEdition') != 5
SET @SQL += N'USE master;' + @CrLf + @CrLf
+ N'IF EXISTS(SELECT 1 FROM sys.databases WHERE name = N''WideWorldImporters'')' + @CrLf
+ N'BEGIN' + @CrLf
+ N' ALTER DATABASE WideWorldImporters SET SINGLE_USER WITH ROLLBACK IMMEDIATE;' + @CrLf
@@ -112,25 +114,26 @@ SET @SQL += N'USE master;' + @CrLf + @CrLf
+ N' SIZE = 100MB,' + @CrLf
+ N' MAXSIZE = UNLIMITED,' + @CrLf
+ N' FILEGROWTH = 64MB' + @CrLf
+ N')' + @CrLf
+ N'COLLATE Latin1_General_100_CI_AS;' + @CrLf + @GO
+ N'ALTER DATABASE WideWorldImporters SET RECOVERY SIMPLE;' + @CrLf + @GO
+ N'ALTER DATABASE WideWorldImporters SET AUTO_UPDATE_STATISTICS_ASYNC ON;' + @CrLf + @GO
+ N'ALTER AUTHORIZATION ON DATABASE::WideWorldImporters to sa;' + @CrLf + @GO
+ N'ALTER DATABASE WideWorldImporters' + @CrLf
+ N'SET QUERY_STORE' + @CrLf
+ N'(' + @CrLf
+ @Indent + N'OPERATION_MODE = READ_WRITE,' + @CrLf
+ @Indent + N'CLEANUP_POLICY = (STALE_QUERY_THRESHOLD_DAYS = 30),' + @CrLf
+ @Indent + N'DATA_FLUSH_INTERVAL_SECONDS = 3000,' + @CrLf
+ @Indent + N'MAX_STORAGE_SIZE_MB = 500,' + @CrLf
+ @Indent + N'INTERVAL_LENGTH_MINUTES = 15,' + @CrLf
+ @Indent + N'SIZE_BASED_CLEANUP_MODE = AUTO,' + @CrLf
+ @Indent + N'QUERY_CAPTURE_MODE = AUTO,' + @CrLf
+ @Indent + N'MAX_PLANS_PER_QUERY = 1000' + @CrLf
+ N');' + @CrLf + @GO
+ N'ALTER AUTHORIZATION ON DATABASE::WideWorldImporters to sa;' + @CrLf + @GO
+ N'USE WideWorldImporters;' + @CrLf + @GO;
SET @SQL += N'ALTER DATABASE CURRENT COLLATE Latin1_General_100_CI_AS;' + @CrLf + @GO
+ N'ALTER DATABASE CURRENT SET RECOVERY SIMPLE;' + @CrLf + @GO
+ N'ALTER DATABASE CURRENT SET AUTO_UPDATE_STATISTICS_ASYNC ON;' + @CrLf + @GO
+ N'ALTER DATABASE CURRENT' + @CrLf
+ N'SET QUERY_STORE' + @CrLf
+ N'(' + @CrLf
+ @Indent + N'OPERATION_MODE = READ_WRITE,' + @CrLf
+ @Indent + N'CLEANUP_POLICY = (STALE_QUERY_THRESHOLD_DAYS = 30),' + @CrLf
+ @Indent + N'DATA_FLUSH_INTERVAL_SECONDS = 3000,' + @CrLf
+ @Indent + N'MAX_STORAGE_SIZE_MB = 500,' + @CrLf
+ @Indent + N'INTERVAL_LENGTH_MINUTES = 15,' + @CrLf
+ @Indent + N'SIZE_BASED_CLEANUP_MODE = AUTO,' + @CrLf
+ @Indent + N'QUERY_CAPTURE_MODE = AUTO,' + @CrLf
+ @Indent + N'MAX_PLANS_PER_QUERY = 1000' + @CrLf
+ N');' + @CrLf + @GO
DECLARE SchemaList CURSOR FAST_FORWARD READ_ONLY
FOR
SELECT SchemaName, SchemaDescription
@@ -31,20 +31,25 @@ LOG ON
SIZE = 100MB,
MAXSIZE = UNLIMITED,
FILEGROWTH = 64MB
)
COLLATE Latin1_General_100_CI_AS;
GO
ALTER DATABASE WideWorldImporters SET RECOVERY SIMPLE;
GO
ALTER DATABASE WideWorldImporters SET AUTO_UPDATE_STATISTICS_ASYNC ON;
);
GO
ALTER AUTHORIZATION ON DATABASE::WideWorldImporters to sa;
GO
ALTER DATABASE WideWorldImporters
USE WideWorldImporters;
GO
ALTER DATABASE CURRENT COLLATE Latin1_General_100_CI_AS;
GO
ALTER DATABASE CURRENT SET RECOVERY SIMPLE;
GO
ALTER DATABASE CURRENT SET AUTO_UPDATE_STATISTICS_ASYNC ON;
GO
ALTER DATABASE CURRENT
SET QUERY_STORE
(
OPERATION_MODE = READ_WRITE,
@@ -58,9 +63,6 @@ SET QUERY_STORE
);
GO
USE WideWorldImporters;
GO
CREATE SCHEMA [Application] AUTHORIZATION dbo;
GO
EXEC sys.sp_addextendedproperty @name = N'Description', @value = N'Tables common across the application. Used for categorization and lookup lists, system parameters and people (users and contacts)', @level0type = N'SCHEMA', @level0name = 'Application';
@@ -4626,19 +4626,38 @@ FOR VALUES (N''20140101'', N''20150101'', N''20160101'', N''20170101'');';
IF NOT EXISTS (SELECT * FROM sys.partition_schemes WHERE name = N'PS_TransactionDateTime')
BEGIN
SET @SQL = N'
-- for Azure DB, assign to primary filegroup
IF SERVERPROPERTY('EngineEdition') = 5
SET @SQL = N'
CREATE PARTITION SCHEME PS_TransactionDateTime
AS PARTITION PF_TransactionDateTime
ALL TO ([PRIMARY]);';
-- for other engine editions, assign to user data filegroup
IF SERVERPROPERTY('EngineEdition') != 5
SET @SQL = N'
CREATE PARTITION SCHEME PS_TransactionDateTime
AS PARTITION PF_TransactionDateTime
ALL TO ([USERDATA]);';
EXECUTE (@SQL);
END;
IF NOT EXISTS (SELECT 1 FROM sys.partition_schemes WHERE name = N'PS_TransactionDate')
BEGIN
-- for Azure DB, assign to primary filegroup
IF SERVERPROPERTY('EngineEdition') = 5
SET @SQL = N'
CREATE PARTITION SCHEME PS_TransactionDate
AS PARTITION PF_TransactionDate
ALL TO ([PRIMARY]);';
-- for other engine editions, assign to user data filegroup
IF SERVERPROPERTY('EngineEdition') != 5
SET @SQL = N'
CREATE PARTITION SCHEME PS_TransactionDate
AS PARTITION PF_TransactionDate
ALL TO ([USERDATA]);';
EXECUTE (@SQL);
END;
@@ -72,7 +72,9 @@ DECLARE @PrimaryKeyColumn nvarchar(max) = N'';
SET @SQL = N'';
SET @SQL += N'USE master;' + @CrLf + @CrLf
-- when not using Azure DB, add create database statement
IF SERVERPROPERTY('EngineEdition') != 5
SET @SQL += N'USE master;' + @CrLf + @CrLf
+ N'IF EXISTS(SELECT 1 FROM sys.databases WHERE name = N''WideWorldImportersDW'')' + @CrLf
+ N'BEGIN' + @CrLf
+ N' ALTER DATABASE WideWorldImportersDW SET SINGLE_USER WITH ROLLBACK IMMEDIATE;' + @CrLf
@@ -102,25 +104,28 @@ SET @SQL += N'USE master;' + @CrLf + @CrLf
+ N' SIZE = 100MB,' + @CrLf
+ N' MAXSIZE = UNLIMITED,' + @CrLf
+ N' FILEGROWTH = 64MB' + @CrLf
+ N')' + @CrLf
+ N'COLLATE Latin1_General_100_CI_AS;' + @CrLf + @GO
+ N'ALTER DATABASE WideWorldImportersDW SET RECOVERY SIMPLE;' + @CrLf + @GO
+ N'ALTER DATABASE WideWorldImporters SET AUTO_UPDATE_STATISTICS_ASYNC ON;' + @CrLf + @GO
+ N'ALTER AUTHORIZATION ON DATABASE::WideWorldImportersDW to sa;' + @CrLf + @GO
+ N'ALTER DATABASE WideWorldImportersDW' + @CrLf
+ N'SET QUERY_STORE' + @CrLf
+ N'(' + @CrLf
+ @Indent + N'OPERATION_MODE = READ_WRITE,' + @CrLf
+ @Indent + N'CLEANUP_POLICY = (STALE_QUERY_THRESHOLD_DAYS = 30),' + @CrLf
+ @Indent + N'DATA_FLUSH_INTERVAL_SECONDS = 3000,' + @CrLf
+ @Indent + N'MAX_STORAGE_SIZE_MB = 500,' + @CrLf
+ @Indent + N'INTERVAL_LENGTH_MINUTES = 15,' + @CrLf
+ @Indent + N'SIZE_BASED_CLEANUP_MODE = AUTO,' + @CrLf
+ @Indent + N'QUERY_CAPTURE_MODE = AUTO,' + @CrLf
+ @Indent + N'MAX_PLANS_PER_QUERY = 1000' + @CrLf
+ N');' + @CrLf + @GO
+ N'ALTER AUTHORIZATION ON DATABASE::WideWorldImportersDW to sa;' + @CrLf + @GO
+ N'USE WideWorldImportersDW;' + @CrLf + @GO;
SET @SQL += N'ALTER DATABASE CURRENT COLLATE Latin1_General_100_CI_AS;' + @CrLf + @GO
+ N'ALTER DATABASE CURRENT SET RECOVERY SIMPLE;' + @CrLf + @GO
+ N'ALTER DATABASE CURRENT SET AUTO_UPDATE_STATISTICS_ASYNC ON;' + @CrLf + @GO
+ N'ALTER DATABASE CURRENT' + @CrLf
+ N'SET QUERY_STORE' + @CrLf
+ N'(' + @CrLf
+ @Indent + N'OPERATION_MODE = READ_WRITE,' + @CrLf
+ @Indent + N'CLEANUP_POLICY = (STALE_QUERY_THRESHOLD_DAYS = 30),' + @CrLf
+ @Indent + N'DATA_FLUSH_INTERVAL_SECONDS = 3000,' + @CrLf
+ @Indent + N'MAX_STORAGE_SIZE_MB = 500,' + @CrLf
+ @Indent + N'INTERVAL_LENGTH_MINUTES = 15,' + @CrLf
+ @Indent + N'SIZE_BASED_CLEANUP_MODE = AUTO,' + @CrLf
+ @Indent + N'QUERY_CAPTURE_MODE = AUTO,' + @CrLf
+ @Indent + N'MAX_PLANS_PER_QUERY = 1000' + @CrLf
+ N');' + @CrLf + @GO
DECLARE SchemaList CURSOR FAST_FORWARD READ_ONLY
FOR
SELECT SchemaName, SchemaDescription
@@ -1552,7 +1552,15 @@ FOR VALUES (N''20120101'',N''20130101'',N''20140101'', N''20150101'', N''2016010
IF NOT EXISTS (SELECT 1 FROM sys.partition_schemes WHERE name = N'PS_Date')
BEGIN
SET @SQL = N'
-- for Azure DB, assign to primary filegroup
IF SERVERPROPERTY('EngineEdition') = 5
SET @SQL = N'
CREATE PARTITION SCHEME PS_Date
AS PARTITION PF_Date
ALL TO ([PRIMARY]);';
-- for other engine editions, assign to user data filegroup
IF SERVERPROPERTY('EngineEdition') != 5
SET @SQL = N'
CREATE PARTITION SCHEME PS_Date
AS PARTITION PF_Date
ALL TO ([USERDATA]);';