mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-16 01:25:41 -05:00
Perf Test fixing bugs and Update command (#155)
* Fixed some bugs caused by rafactoring * Verifying a test db is created before running the tests
This commit is contained in:
@@ -1,682 +0,0 @@
|
||||
USE [AdventureWorks2016CTP3]
|
||||
GO
|
||||
|
||||
SELECT [SystemInformationID]
|
||||
,[Database Version]
|
||||
,[VersionDate]
|
||||
,[ModifiedDate]
|
||||
FROM [dbo].[AWBuildVersion]
|
||||
GO
|
||||
|
||||
|
||||
GO
|
||||
|
||||
SELECT [DatabaseLogID]
|
||||
,[PostTime]
|
||||
,[DatabaseUser]
|
||||
,[Event]
|
||||
,[Schema]
|
||||
,[Object]
|
||||
,[TSQL]
|
||||
,[XmlEvent]
|
||||
FROM [dbo].[DatabaseLog]
|
||||
GO
|
||||
|
||||
|
||||
SELECT [OrderQty]
|
||||
,[ProductID]
|
||||
,[SpecialOfferID]
|
||||
,[OrderID]
|
||||
,[LocalID]
|
||||
FROM [Demo].[DemoSalesOrderDetailSeed]
|
||||
GO
|
||||
|
||||
SELECT [DueDate]
|
||||
,[CustomerID]
|
||||
,[SalesPersonID]
|
||||
,[BillToAddressID]
|
||||
,[ShipToAddressID]
|
||||
,[ShipMethodID]
|
||||
,[LocalID]
|
||||
FROM [Demo].[DemoSalesOrderHeaderSeed]
|
||||
GO
|
||||
|
||||
SELECT [DepartmentID]
|
||||
,[Name]
|
||||
,[GroupName]
|
||||
,[ModifiedDate]
|
||||
FROM [HumanResources].[Department]
|
||||
GO
|
||||
|
||||
SELECT [BusinessEntityID]
|
||||
,[NationalIDNumber]
|
||||
,[LoginID]
|
||||
,[OrganizationNode]
|
||||
,[OrganizationLevel]
|
||||
,[JobTitle]
|
||||
,[BirthDate]
|
||||
,[MaritalStatus]
|
||||
,[Gender]
|
||||
,[HireDate]
|
||||
,[SalariedFlag]
|
||||
,[VacationHours]
|
||||
,[SickLeaveHours]
|
||||
,[CurrentFlag]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [HumanResources].[Employee]
|
||||
GO
|
||||
|
||||
SELECT [TrackingEventID]
|
||||
,[EventName]
|
||||
FROM [Sales].[TrackingEvent]
|
||||
GO
|
||||
|
||||
SELECT [SalesTaxRateID]
|
||||
,[StateProvinceID]
|
||||
,[TaxType]
|
||||
,[TaxRate]
|
||||
,[Name]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Sales].[SalesTaxRate]
|
||||
GO
|
||||
|
||||
SELECT [SalesOrderID]
|
||||
,[SalesOrderDetailID]
|
||||
,[CarrierTrackingNumber]
|
||||
,[OrderQty]
|
||||
,[ProductID]
|
||||
,[SpecialOfferID]
|
||||
,[UnitPrice]
|
||||
,[UnitPriceDiscount]
|
||||
,[ModifiedDate]
|
||||
FROM [Sales].[SalesOrderDetail_inmem]
|
||||
GO
|
||||
|
||||
SELECT [SalesOrderID]
|
||||
,[RevisionNumber]
|
||||
,[OrderDate]
|
||||
,[DueDate]
|
||||
,[ShipDate]
|
||||
,[Status]
|
||||
,[OnlineOrderFlag]
|
||||
,[SalesOrderNumber]
|
||||
,[PurchaseOrderNumber]
|
||||
,[AccountNumber]
|
||||
,[CustomerID]
|
||||
,[SalesPersonID]
|
||||
,[TerritoryID]
|
||||
,[BillToAddressID]
|
||||
,[ShipToAddressID]
|
||||
,[ShipMethodID]
|
||||
,[CreditCardID]
|
||||
,[CreditCardApprovalCode]
|
||||
,[CurrencyRateID]
|
||||
,[SubTotal]
|
||||
,[TaxAmt]
|
||||
,[Freight]
|
||||
,[TotalDue]
|
||||
,[Comment]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Sales].[SalesOrderHeader]
|
||||
GO
|
||||
|
||||
|
||||
|
||||
SELECT [SalesOrderID]
|
||||
,[RevisionNumber]
|
||||
,[OrderDate]
|
||||
,[DueDate]
|
||||
,[ShipDate]
|
||||
,[Status]
|
||||
,[OnlineOrderFlag]
|
||||
,[SalesOrderNumber]
|
||||
,[PurchaseOrderNumber]
|
||||
,[AccountNumber]
|
||||
,[CustomerID]
|
||||
,[SalesPersonID]
|
||||
,[TerritoryID]
|
||||
,[BillToAddressID]
|
||||
,[ShipToAddressID]
|
||||
,[ShipMethodID]
|
||||
,[CreditCardID]
|
||||
,[CreditCardApprovalCode]
|
||||
,[CurrencyRateID]
|
||||
,[SubTotal]
|
||||
,[TaxAmt]
|
||||
,[Freight]
|
||||
,[TotalDue]
|
||||
,[Comment]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Sales].[SalesOrder_json]
|
||||
GO
|
||||
|
||||
SELECT [BusinessEntityID]
|
||||
,[CreditCardID]
|
||||
,[ModifiedDate]
|
||||
FROM [Sales].[PersonCreditCard]
|
||||
GO
|
||||
|
||||
SELECT [OrderTrackingID]
|
||||
,[SalesOrderID]
|
||||
,[CarrierTrackingNumber]
|
||||
,[TrackingEventID]
|
||||
,[EventDetails]
|
||||
,[EventDateTime]
|
||||
FROM [Sales].[OrderTracking]
|
||||
GO
|
||||
|
||||
SELECT [CustomerID]
|
||||
,[FirstName]
|
||||
,[LastName]
|
||||
,[SSN]
|
||||
,[CreditCardNumber]
|
||||
,[EmailAddress]
|
||||
,[PhoneNumber]
|
||||
,[TerritoryID]
|
||||
FROM [Sales].[CustomerPII]
|
||||
GO
|
||||
|
||||
SELECT [CustomerID]
|
||||
,[PersonID]
|
||||
,[StoreID]
|
||||
,[TerritoryID]
|
||||
,[AccountNumber]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Sales].[Customer]
|
||||
GO
|
||||
|
||||
SELECT [CurrencyRateID]
|
||||
,[CurrencyRateDate]
|
||||
,[FromCurrencyCode]
|
||||
,[ToCurrencyCode]
|
||||
,[AverageRate]
|
||||
,[EndOfDayRate]
|
||||
,[ModifiedDate]
|
||||
FROM [Sales].[CurrencyRate]
|
||||
GO
|
||||
|
||||
|
||||
SELECT [CurrencyCode]
|
||||
,[Name]
|
||||
,[ModifiedDate]
|
||||
FROM [Sales].[Currency]
|
||||
GO
|
||||
|
||||
SELECT [CreditCardID]
|
||||
,[CardType]
|
||||
,[CardNumber]
|
||||
,[ExpMonth]
|
||||
,[ExpYear]
|
||||
,[ModifiedDate]
|
||||
FROM [Sales].[CreditCard]
|
||||
GO
|
||||
|
||||
SELECT [CountryRegionCode]
|
||||
,[CurrencyCode]
|
||||
,[ModifiedDate]
|
||||
FROM [Sales].[CountryRegionCurrency]
|
||||
GO
|
||||
|
||||
SELECT [BusinessEntityID]
|
||||
,[AccountNumber]
|
||||
,[Name]
|
||||
,[CreditRating]
|
||||
,[PreferredVendorStatus]
|
||||
,[ActiveFlag]
|
||||
,[PurchasingWebServiceURL]
|
||||
,[ModifiedDate]
|
||||
FROM [Purchasing].[Vendor]
|
||||
GO
|
||||
|
||||
SELECT [ShipMethodID]
|
||||
,[Name]
|
||||
,[ShipBase]
|
||||
,[ShipRate]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Purchasing].[ShipMethod]
|
||||
GO
|
||||
|
||||
SELECT [PurchaseOrderID]
|
||||
,[RevisionNumber]
|
||||
,[Status]
|
||||
,[EmployeeID]
|
||||
,[VendorID]
|
||||
,[ShipMethodID]
|
||||
,[OrderDate]
|
||||
,[ShipDate]
|
||||
,[SubTotal]
|
||||
,[TaxAmt]
|
||||
,[Freight]
|
||||
,[TotalDue]
|
||||
,[ModifiedDate]
|
||||
FROM [Purchasing].[PurchaseOrderHeader]
|
||||
GO
|
||||
|
||||
SELECT [PurchaseOrderID]
|
||||
,[PurchaseOrderDetailID]
|
||||
,[DueDate]
|
||||
,[OrderQty]
|
||||
,[ProductID]
|
||||
,[UnitPrice]
|
||||
,[LineTotal]
|
||||
,[ReceivedQty]
|
||||
,[RejectedQty]
|
||||
,[StockedQty]
|
||||
,[ModifiedDate]
|
||||
FROM [Purchasing].[PurchaseOrderDetail]
|
||||
GO
|
||||
|
||||
SELECT [LocationID]
|
||||
,[Name]
|
||||
,[CostRate]
|
||||
,[Availability]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[Location]
|
||||
GO
|
||||
|
||||
|
||||
SELECT [ProductID]
|
||||
,[Name]
|
||||
,[ProductNumber]
|
||||
,[MakeFlag]
|
||||
,[FinishedGoodsFlag]
|
||||
,[Color]
|
||||
,[SafetyStockLevel]
|
||||
,[ReorderPoint]
|
||||
,[StandardCost]
|
||||
,[ListPrice]
|
||||
,[Size]
|
||||
,[SizeUnitMeasureCode]
|
||||
,[WeightUnitMeasureCode]
|
||||
,[Weight]
|
||||
,[DaysToManufacture]
|
||||
,[ProductLine]
|
||||
,[Class]
|
||||
,[Style]
|
||||
,[ProductSubcategoryID]
|
||||
,[ProductModelID]
|
||||
,[SellStartDate]
|
||||
,[SellEndDate]
|
||||
,[DiscontinuedDate]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[Product]
|
||||
GO
|
||||
|
||||
SELECT [ProductID]
|
||||
,[Name]
|
||||
,[ProductNumber]
|
||||
,[MakeFlag]
|
||||
,[FinishedGoodsFlag]
|
||||
,[Color]
|
||||
,[SafetyStockLevel]
|
||||
,[ReorderPoint]
|
||||
,[StandardCost]
|
||||
,[ListPrice]
|
||||
,[Size]
|
||||
,[SizeUnitMeasureCode]
|
||||
,[WeightUnitMeasureCode]
|
||||
,[Weight]
|
||||
,[DaysToManufacture]
|
||||
,[ProductLine]
|
||||
,[Class]
|
||||
,[Style]
|
||||
,[ProductSubcategoryID]
|
||||
,[ProductModelID]
|
||||
,[SellStartDate]
|
||||
,[SellEndDate]
|
||||
,[DiscontinuedDate]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[Product_inmem]
|
||||
GO
|
||||
|
||||
SELECT [ProductID]
|
||||
,[Name]
|
||||
,[ProductNumber]
|
||||
,[MakeFlag]
|
||||
,[FinishedGoodsFlag]
|
||||
,[Color]
|
||||
,[SafetyStockLevel]
|
||||
,[ReorderPoint]
|
||||
,[StandardCost]
|
||||
,[ListPrice]
|
||||
,[Size]
|
||||
,[SizeUnitMeasureCode]
|
||||
,[WeightUnitMeasureCode]
|
||||
,[Weight]
|
||||
,[DaysToManufacture]
|
||||
,[ProductLine]
|
||||
,[Class]
|
||||
,[Style]
|
||||
,[ProductSubcategoryID]
|
||||
,[ProductModelID]
|
||||
,[SellStartDate]
|
||||
,[SellEndDate]
|
||||
,[DiscontinuedDate]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[Product_ondisk]
|
||||
GO
|
||||
|
||||
SELECT [ProductCategoryID]
|
||||
,[Name]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[ProductCategory]
|
||||
GO
|
||||
|
||||
SELECT [ProductID]
|
||||
,[StartDate]
|
||||
,[EndDate]
|
||||
,[StandardCost]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[ProductCostHistory]
|
||||
GO
|
||||
|
||||
SELECT [ProductDescriptionID]
|
||||
,[Description]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[ProductDescription]
|
||||
GO
|
||||
|
||||
|
||||
SELECT [ProductID]
|
||||
,[DocumentNode]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[ProductDocument]
|
||||
GO
|
||||
|
||||
SELECT [ProductID]
|
||||
,[LocationID]
|
||||
,[Shelf]
|
||||
,[Bin]
|
||||
,[Quantity]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[ProductInventory]
|
||||
GO
|
||||
|
||||
SELECT [ProductID]
|
||||
,[StartDate]
|
||||
,[EndDate]
|
||||
,[ListPrice]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[ProductListPriceHistory]
|
||||
GO
|
||||
|
||||
SELECT [ProductModelID]
|
||||
,[Name]
|
||||
,[CatalogDescription]
|
||||
,[Instructions]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[ProductModel]
|
||||
GO
|
||||
|
||||
SELECT [ProductModelID]
|
||||
,[IllustrationID]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[ProductModelIllustration]
|
||||
GO
|
||||
|
||||
SELECT [ProductModelID]
|
||||
,[IllustrationID]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[ProductModelIllustration]
|
||||
GO
|
||||
SELECT [ProductModelID]
|
||||
,[ProductDescriptionID]
|
||||
,[CultureID]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[ProductModelProductDescriptionCulture]
|
||||
GO
|
||||
SELECT [ProductPhotoID]
|
||||
,[ThumbNailPhoto]
|
||||
,[ThumbnailPhotoFileName]
|
||||
,[LargePhoto]
|
||||
,[LargePhotoFileName]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[ProductPhoto]
|
||||
GO
|
||||
SELECT [ProductID]
|
||||
,[ProductPhotoID]
|
||||
,[Primary]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[ProductProductPhoto]
|
||||
GO
|
||||
SELECT [ProductReviewID]
|
||||
,[ProductID]
|
||||
,[ReviewerName]
|
||||
,[ReviewDate]
|
||||
,[EmailAddress]
|
||||
,[Rating]
|
||||
,[Comments]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[ProductReview]
|
||||
GO
|
||||
|
||||
SELECT [TransactionID]
|
||||
,[ProductID]
|
||||
,[ReferenceOrderID]
|
||||
,[ReferenceOrderLineID]
|
||||
,[TransactionDate]
|
||||
,[TransactionType]
|
||||
,[Quantity]
|
||||
,[ActualCost]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[TransactionHistory]
|
||||
GO
|
||||
|
||||
SELECT [TransactionID]
|
||||
,[ProductID]
|
||||
,[ReferenceOrderID]
|
||||
,[ReferenceOrderLineID]
|
||||
,[TransactionDate]
|
||||
,[TransactionType]
|
||||
,[Quantity]
|
||||
,[ActualCost]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[TransactionHistoryArchive]
|
||||
GO
|
||||
SELECT [UnitMeasureCode]
|
||||
,[Name]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[UnitMeasure]
|
||||
GO
|
||||
|
||||
SELECT [WorkOrderID]
|
||||
,[ProductID]
|
||||
,[OrderQty]
|
||||
,[StockedQty]
|
||||
,[ScrappedQty]
|
||||
,[StartDate]
|
||||
,[EndDate]
|
||||
,[DueDate]
|
||||
,[ScrapReasonID]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[WorkOrder]
|
||||
GO
|
||||
SELECT [WorkOrderID]
|
||||
,[ProductID]
|
||||
,[OperationSequence]
|
||||
,[LocationID]
|
||||
,[ScheduledStartDate]
|
||||
,[ScheduledEndDate]
|
||||
,[ActualStartDate]
|
||||
,[ActualEndDate]
|
||||
,[ActualResourceHrs]
|
||||
,[PlannedCost]
|
||||
,[ActualCost]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[WorkOrderRouting]
|
||||
GO
|
||||
|
||||
SELECT [ProductID]
|
||||
,[BusinessEntityID]
|
||||
,[AverageLeadTime]
|
||||
,[StandardPrice]
|
||||
,[LastReceiptCost]
|
||||
,[LastReceiptDate]
|
||||
,[MinOrderQty]
|
||||
,[MaxOrderQty]
|
||||
,[OnOrderQty]
|
||||
,[UnitMeasureCode]
|
||||
,[ModifiedDate]
|
||||
FROM [Purchasing].[ProductVendor]
|
||||
GO
|
||||
|
||||
SELECT [PurchaseOrderID]
|
||||
,[PurchaseOrderDetailID]
|
||||
,[DueDate]
|
||||
,[OrderQty]
|
||||
,[ProductID]
|
||||
,[UnitPrice]
|
||||
,[LineTotal]
|
||||
,[ReceivedQty]
|
||||
,[RejectedQty]
|
||||
,[StockedQty]
|
||||
,[ModifiedDate]
|
||||
FROM [Purchasing].[PurchaseOrderDetail]
|
||||
GO
|
||||
SELECT [AddressID]
|
||||
,[AddressLine1]
|
||||
,[AddressLine2]
|
||||
,[City]
|
||||
,[StateProvinceID]
|
||||
,[PostalCode]
|
||||
,[SpatialLocation]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[Address]
|
||||
GO
|
||||
SELECT [AddressTypeID]
|
||||
,[Name]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[AddressType]
|
||||
GO
|
||||
SELECT [BusinessEntityID]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[BusinessEntity]
|
||||
GO
|
||||
SELECT [BusinessEntityID]
|
||||
,[AddressID]
|
||||
,[AddressTypeID]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[BusinessEntityAddress]
|
||||
GO
|
||||
SELECT [BusinessEntityID]
|
||||
,[PersonID]
|
||||
,[ContactTypeID]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[BusinessEntityContact]
|
||||
GO
|
||||
SELECT [ContactTypeID]
|
||||
,[Name]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[ContactType]
|
||||
GO
|
||||
SELECT [CountryRegionCode]
|
||||
,[Name]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[CountryRegion]
|
||||
GO
|
||||
|
||||
SELECT [BusinessEntityID]
|
||||
,[EmailAddressID]
|
||||
,[EmailAddress]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[EmailAddress]
|
||||
GO
|
||||
SELECT [BusinessEntityID]
|
||||
,[PasswordHash]
|
||||
,[PasswordSalt]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[Password]
|
||||
GO
|
||||
|
||||
SELECT [BusinessEntityID]
|
||||
,[PersonType]
|
||||
,[NameStyle]
|
||||
,[Title]
|
||||
,[FirstName]
|
||||
,[MiddleName]
|
||||
,[LastName]
|
||||
,[Suffix]
|
||||
,[EmailPromotion]
|
||||
,[AdditionalContactInfo]
|
||||
,[Demographics]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[Person]
|
||||
GO
|
||||
SELECT [PersonID]
|
||||
,[PersonType]
|
||||
,[NameStyle]
|
||||
,[Title]
|
||||
,[FirstName]
|
||||
,[MiddleName]
|
||||
,[LastName]
|
||||
,[Suffix]
|
||||
,[EmailPromotion]
|
||||
,[AdditionalContactInfo]
|
||||
,[Demographics]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[Person_json]
|
||||
GO
|
||||
SELECT [BusinessEntityID]
|
||||
,[NationalIDNumber]
|
||||
,[LoginID]
|
||||
,[OrganizationNode]
|
||||
,[OrganizationLevel]
|
||||
,[JobTitle]
|
||||
,[BirthDate]
|
||||
,[MaritalStatus]
|
||||
,[Gender]
|
||||
,[HireDate]
|
||||
,[VacationHours]
|
||||
,[SickLeaveHours]
|
||||
,[ValidFrom]
|
||||
,[ValidTo]
|
||||
FROM [HumanResources].[Employee_Temporal]
|
||||
GO
|
||||
SELECT [BusinessEntityID]
|
||||
,[DepartmentID]
|
||||
,[ShiftID]
|
||||
,[StartDate]
|
||||
,[EndDate]
|
||||
,[ModifiedDate]
|
||||
FROM [HumanResources].[EmployeeDepartmentHistory]
|
||||
GO
|
||||
SELECT [BusinessEntityID]
|
||||
,[RateChangeDate]
|
||||
,[Rate]
|
||||
,[PayFrequency]
|
||||
,[ModifiedDate]
|
||||
FROM [HumanResources].[EmployeePayHistory]
|
||||
GO
|
||||
SELECT [JobCandidateID]
|
||||
,[BusinessEntityID]
|
||||
,[Resume]
|
||||
,[ModifiedDate]
|
||||
FROM [HumanResources].[JobCandidate]
|
||||
GO
|
||||
SELECT [ShiftID]
|
||||
,[Name]
|
||||
,[StartTime]
|
||||
,[EndTime]
|
||||
,[ModifiedDate]
|
||||
FROM [HumanResources].[Shift]
|
||||
GO
|
||||
@@ -0,0 +1,13 @@
|
||||
USE master
|
||||
GO
|
||||
|
||||
DECLARE @dbname nvarchar(128)
|
||||
SET @dbname = N'#DatabaseName#'
|
||||
|
||||
IF NOT(EXISTS (SELECT name
|
||||
FROM master.dbo.sysdatabases
|
||||
WHERE ('[' + name + ']' = @dbname
|
||||
OR name = @dbname)))
|
||||
BEGIN
|
||||
CREATE DATABASE #DatabaseName#
|
||||
END
|
||||
@@ -0,0 +1,231 @@
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = 'Demo')
|
||||
BEGIN
|
||||
EXEC('CREATE SCHEMA [Demo]')
|
||||
END
|
||||
|
||||
GO
|
||||
IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = 'HumanResources')
|
||||
BEGIN
|
||||
EXEC('CREATE SCHEMA [HumanResources]')
|
||||
END
|
||||
GO
|
||||
IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = 'Person')
|
||||
BEGIN
|
||||
EXEC('CREATE SCHEMA [Person]')
|
||||
END
|
||||
GO
|
||||
IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = 'Production')
|
||||
BEGIN
|
||||
EXEC('CREATE SCHEMA [Production]')
|
||||
END
|
||||
GO
|
||||
IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = 'Purchasing')
|
||||
BEGIN
|
||||
EXEC('CREATE SCHEMA [Purchasing]')
|
||||
END
|
||||
GO
|
||||
IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = 'Sales')
|
||||
BEGIN
|
||||
EXEC('CREATE SCHEMA [Sales]')
|
||||
END
|
||||
GO
|
||||
IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = 'Security')
|
||||
BEGIN
|
||||
EXEC('CREATE SCHEMA [Security]')
|
||||
END
|
||||
GO
|
||||
IF NOT EXISTS (SELECT * FROM sys.types WHERE name = 'AccountNumber')
|
||||
BEGIN
|
||||
CREATE TYPE [dbo].[AccountNumber] FROM [nvarchar](15) NULL
|
||||
END
|
||||
GO
|
||||
IF NOT EXISTS (SELECT * FROM sys.types WHERE name = 'Flag')
|
||||
BEGIN
|
||||
CREATE TYPE [dbo].[Flag] FROM [bit] NOT NULL
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM sys.types WHERE name = 'Name')
|
||||
BEGIN
|
||||
CREATE TYPE [dbo].[Name] FROM [nvarchar](50) NULL
|
||||
END
|
||||
GO
|
||||
IF NOT EXISTS (SELECT * FROM sys.types WHERE name = 'NameStyle')
|
||||
BEGIN
|
||||
CREATE TYPE [dbo].[NameStyle] FROM [bit] NOT NULL
|
||||
END
|
||||
GO
|
||||
IF NOT EXISTS (SELECT * FROM sys.types WHERE name = 'OrderNumber')
|
||||
BEGIN
|
||||
CREATE TYPE [dbo].[OrderNumber] FROM [nvarchar](25) NULL
|
||||
END
|
||||
GO
|
||||
|
||||
GO
|
||||
IF NOT EXISTS (SELECT * FROM sys.types WHERE name = 'Phone')
|
||||
BEGIN
|
||||
CREATE TYPE [dbo].[Phone] FROM [nvarchar](25) NULL
|
||||
END
|
||||
GO
|
||||
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'Address')
|
||||
BEGIN
|
||||
CREATE TABLE [Person].[Address](
|
||||
[AddressID] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
|
||||
[AddressLine1] [nvarchar](60) NOT NULL,
|
||||
[AddressLine2] [nvarchar](60) NULL,
|
||||
[City] [nvarchar](30) NOT NULL,
|
||||
[StateProvinceID] [int] NOT NULL,
|
||||
[PostalCode] [nvarchar](15) NOT NULL,
|
||||
[SpatialLocation] [geography] NULL,
|
||||
[rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL,
|
||||
[ModifiedDate] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_Address_AddressID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[AddressID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'AddressType')
|
||||
BEGIN
|
||||
CREATE TABLE [Person].[AddressType](
|
||||
[AddressTypeID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[Name] [dbo].[Name] NOT NULL,
|
||||
[rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL,
|
||||
[ModifiedDate] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_AddressType_AddressTypeID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[AddressTypeID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
END
|
||||
GO
|
||||
/****** Object: Table [Person].[ContactType] Script Date: 11/22/2016 9:25:52 AM ******/
|
||||
IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'ContactType')
|
||||
BEGIN
|
||||
CREATE TABLE [Person].[ContactType](
|
||||
[ContactTypeID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[Name] [dbo].[Name] NOT NULL,
|
||||
[ModifiedDate] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_ContactType_ContactTypeID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ContactTypeID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'EmailAddress')
|
||||
BEGIN
|
||||
CREATE TABLE [Person].[EmailAddress](
|
||||
[BusinessEntityID] [int] NOT NULL,
|
||||
[EmailAddressID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[EmailAddress] [nvarchar](50) NULL,
|
||||
[rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL,
|
||||
[ModifiedDate] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_EmailAddress_BusinessEntityID_EmailAddressID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[BusinessEntityID] ASC,
|
||||
[EmailAddressID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'Person')
|
||||
BEGIN
|
||||
CREATE TABLE [Person].[Person](
|
||||
[BusinessEntityID] [int] NOT NULL,
|
||||
[PersonType] [nchar](2) NOT NULL,
|
||||
[NameStyle] [dbo].[NameStyle] NOT NULL,
|
||||
[Title] [nvarchar](8) NULL,
|
||||
[FirstName] [dbo].[Name] NOT NULL,
|
||||
[MiddleName] [dbo].[Name] NULL,
|
||||
[LastName] [dbo].[Name] NOT NULL,
|
||||
[Suffix] [nvarchar](10) NULL,
|
||||
[EmailPromotion] [int] NOT NULL,
|
||||
[rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL,
|
||||
[ModifiedDate] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_Person_BusinessEntityID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[BusinessEntityID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'PersonPhone')
|
||||
BEGIN
|
||||
CREATE TABLE [Person].[PersonPhone](
|
||||
[BusinessEntityID] [int] NOT NULL,
|
||||
[PhoneNumber] [dbo].[Phone] NOT NULL,
|
||||
[PhoneNumberTypeID] [int] NOT NULL,
|
||||
[ModifiedDate] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_PersonPhone_BusinessEntityID_PhoneNumber_PhoneNumberTypeID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[BusinessEntityID] ASC,
|
||||
[PhoneNumber] ASC,
|
||||
[PhoneNumberTypeID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'Location')
|
||||
BEGIN
|
||||
CREATE TABLE [Production].[Location](
|
||||
[LocationID] [smallint] IDENTITY(1,1) NOT NULL,
|
||||
[Name] [dbo].[Name] NOT NULL,
|
||||
[CostRate] [smallmoney] NOT NULL,
|
||||
[Availability] [decimal](8, 2) NOT NULL,
|
||||
[ModifiedDate] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_Location_LocationID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[LocationID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'Product')
|
||||
BEGIN
|
||||
CREATE TABLE [Production].[Product](
|
||||
[ProductID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[Name] [dbo].[Name] NOT NULL,
|
||||
[ProductNumber] [nvarchar](25) NOT NULL,
|
||||
[MakeFlag] [dbo].[Flag] NOT NULL,
|
||||
[FinishedGoodsFlag] [dbo].[Flag] NOT NULL,
|
||||
[Color] [nvarchar](15) NULL,
|
||||
[SafetyStockLevel] [smallint] NOT NULL,
|
||||
[ReorderPoint] [smallint] NOT NULL,
|
||||
[StandardCost] [money] NOT NULL,
|
||||
[ListPrice] [money] NOT NULL,
|
||||
[Size] [nvarchar](5) NULL,
|
||||
[SizeUnitMeasureCode] [nchar](3) NULL,
|
||||
[WeightUnitMeasureCode] [nchar](3) NULL,
|
||||
[Weight] [decimal](8, 2) NULL,
|
||||
[DaysToManufacture] [int] NOT NULL,
|
||||
[ProductLine] [nchar](2) NULL,
|
||||
[Class] [nchar](2) NULL,
|
||||
[Style] [nchar](2) NULL,
|
||||
[ProductSubcategoryID] [int] NULL,
|
||||
[ProductModelID] [int] NULL,
|
||||
[SellStartDate] [datetime] NOT NULL,
|
||||
[SellEndDate] [datetime] NULL,
|
||||
[DiscontinuedDate] [datetime] NULL,
|
||||
[rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL,
|
||||
[ModifiedDate] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_Product_ProductID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ProductID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
END
|
||||
GO
|
||||
@@ -11,27 +11,55 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Scripts
|
||||
{
|
||||
public class Scripts
|
||||
{
|
||||
|
||||
public const string SimpleQuery = "SELECT * FROM sys.all_columns";
|
||||
public const string MasterBasicQuery = "SELECT * FROM sys.all_columns"; //basic queries should return at least 10000 rows
|
||||
|
||||
public const string DelayQuery = "WAITFOR DELAY '00:01:00'";
|
||||
|
||||
private static readonly Lazy<string> ComplexQueryInstance = new Lazy<string>(() =>
|
||||
public const string TestDbSimpleSelectQuery = "SELECT * FROM [Person].[Address]";
|
||||
|
||||
public const string SelectQuery = "SELECT * FROM ";
|
||||
|
||||
public static string CreateDatabaseObjectsQuery { get { return CreateDatabaseObjectsQueryInstance.Value; } }
|
||||
|
||||
public static string CreateDatabaseQuery { get { return CreateDatabaseQueryInstance.Value; } }
|
||||
|
||||
public static string TestDbComplexSelectQueries { get { return TestDbSelectQueriesInstance.Value; } }
|
||||
|
||||
private static readonly Lazy<string> CreateDatabaseObjectsQueryInstance = new Lazy<string>(() =>
|
||||
{
|
||||
return GetScriptFileContent("Microsoft.SqlTools.ServiceLayer.TestDriver.Scripts.CreateTestDatabaseObjects.sql");
|
||||
});
|
||||
|
||||
private static readonly Lazy<string> CreateDatabaseQueryInstance = new Lazy<string>(() =>
|
||||
{
|
||||
return GetScriptFileContent("Microsoft.SqlTools.ServiceLayer.TestDriver.Scripts.CreateTestDatabase.sql");
|
||||
});
|
||||
|
||||
private static readonly Lazy<string> TestDbSelectQueriesInstance = new Lazy<string>(() =>
|
||||
{
|
||||
return GetScriptFileContent("Microsoft.SqlTools.ServiceLayer.TestDriver.Scripts.TestDbTableQueries.sql");
|
||||
});
|
||||
|
||||
private static string GetScriptFileContent(string fileName)
|
||||
{
|
||||
string fileContent = string.Empty;
|
||||
try
|
||||
{
|
||||
string assemblyLocation = typeof(Scripts).GetTypeInfo().Assembly.Location;
|
||||
string folderName = Path.GetDirectoryName(assemblyLocation);
|
||||
string filePath = Path.Combine(folderName, "Scripts/AdventureWorks.sql");
|
||||
return File.ReadAllText(filePath);
|
||||
using (Stream stream = typeof(Scripts).GetTypeInfo().Assembly.GetManifestResourceStream(fileName))
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
fileContent = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Failed to load the sql script. error: {ex.Message}");
|
||||
return string.Empty;
|
||||
}
|
||||
});
|
||||
return fileContent;
|
||||
}
|
||||
|
||||
public static string ComplexQuery { get { return ComplexQueryInstance.Value; } }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
SELECT * FROM [Person].[Address]
|
||||
|
||||
SELECT [AddressID]
|
||||
,[AddressLine1]
|
||||
,[AddressLine2]
|
||||
,[City]
|
||||
,[StateProvinceID]
|
||||
,[PostalCode]
|
||||
,[SpatialLocation]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[Address]
|
||||
GO
|
||||
SELECT [AddressTypeID]
|
||||
,[Name]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[AddressType]
|
||||
GO
|
||||
SELECT [ContactTypeID]
|
||||
,[Name]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[ContactType]
|
||||
GO
|
||||
SELECT [BusinessEntityID]
|
||||
,[EmailAddressID]
|
||||
,[EmailAddress]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[EmailAddress]
|
||||
GO
|
||||
SELECT [BusinessEntityID]
|
||||
,[PersonType]
|
||||
,[NameStyle]
|
||||
,[Title]
|
||||
,[FirstName]
|
||||
,[MiddleName]
|
||||
,[LastName]
|
||||
,[Suffix]
|
||||
,[EmailPromotion]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[Person]
|
||||
GO
|
||||
SELECT [BusinessEntityID]
|
||||
,[PhoneNumber]
|
||||
,[PhoneNumberTypeID]
|
||||
,[ModifiedDate]
|
||||
FROM [Person].[PersonPhone]
|
||||
GO
|
||||
SELECT [LocationID]
|
||||
,[Name]
|
||||
,[CostRate]
|
||||
,[Availability]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[Location]
|
||||
GO
|
||||
SELECT [ProductID]
|
||||
,[Name]
|
||||
,[ProductNumber]
|
||||
,[MakeFlag]
|
||||
,[FinishedGoodsFlag]
|
||||
,[Color]
|
||||
,[SafetyStockLevel]
|
||||
,[ReorderPoint]
|
||||
,[StandardCost]
|
||||
,[ListPrice]
|
||||
,[Size]
|
||||
,[SizeUnitMeasureCode]
|
||||
,[WeightUnitMeasureCode]
|
||||
,[Weight]
|
||||
,[DaysToManufacture]
|
||||
,[ProductLine]
|
||||
,[Class]
|
||||
,[Style]
|
||||
,[ProductSubcategoryID]
|
||||
,[ProductModelID]
|
||||
,[SellStartDate]
|
||||
,[SellEndDate]
|
||||
,[DiscontinuedDate]
|
||||
,[rowguid]
|
||||
,[ModifiedDate]
|
||||
FROM [Production].[Product]
|
||||
GO
|
||||
Reference in New Issue
Block a user