Skip to content

Commit 349ece8

Browse files
committed
adding sqlProj to allow using of dacpacs and bacpacs for azure deployments
1 parent 89679b8 commit 349ece8

File tree

89 files changed

+1478
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1478
-0
lines changed

Rio.Database/Rio.Database.publish.xml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<IncludeCompositeObjects>True</IncludeCompositeObjects>
5+
<DeployScriptFileName>Rio.Database.sql</DeployScriptFileName>
6+
<TargetConnectionString>Data Source=.;Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False</TargetConnectionString>
7+
<BlockOnPossibleDataLoss>False</BlockOnPossibleDataLoss>
8+
<DropObjectsNotInSource>True</DropObjectsNotInSource>
9+
<DoNotDropCredentials>True</DoNotDropCredentials>
10+
<DoNotDropDatabaseRoles>True</DoNotDropDatabaseRoles>
11+
<DoNotDropPermissions>True</DoNotDropPermissions>
12+
<DoNotDropSecurityPolicies>True</DoNotDropSecurityPolicies>
13+
<DoNotDropServerRoles>True</DoNotDropServerRoles>
14+
<DoNotDropServerRoleMembership>True</DoNotDropServerRoleMembership>
15+
<DoNotDropUsers>True</DoNotDropUsers>
16+
<ProfileVersionNumber>1</ProfileVersionNumber>
17+
</PropertyGroup>
18+
</Project>t>

Rio.Database/Rio.Database.sqlproj

+211
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<Name>Rio.Database</Name>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectVersion>4.1</ProjectVersion>
9+
<ProjectGuid>{8851eb6a-bcea-42b4-83dd-125a1bcfaa52}</ProjectGuid>
10+
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql130DatabaseSchemaProvider</DSP>
11+
<OutputType>Database</OutputType>
12+
<RootPath>
13+
</RootPath>
14+
<RootNamespace>Rio.Database</RootNamespace>
15+
<AssemblyName>Rio.Database</AssemblyName>
16+
<ModelCollation>1033,CI</ModelCollation>
17+
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
18+
<DeployToDatabase>True</DeployToDatabase>
19+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
20+
<TargetLanguage>CS</TargetLanguage>
21+
<AppDesignerFolder>Properties</AppDesignerFolder>
22+
<SqlServerVerification>False</SqlServerVerification>
23+
<IncludeCompositeObjects>True</IncludeCompositeObjects>
24+
<TargetDatabaseSet>True</TargetDatabaseSet>
25+
<DefaultCollation>SQL_Latin1_General_CP1_CI_AS</DefaultCollation>
26+
<DefaultFilegroup>PRIMARY</DefaultFilegroup>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<OutputPath>bin\Release\</OutputPath>
30+
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
31+
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
32+
<DebugType>pdbonly</DebugType>
33+
<Optimize>true</Optimize>
34+
<DefineDebug>false</DefineDebug>
35+
<DefineTrace>true</DefineTrace>
36+
<ErrorReport>prompt</ErrorReport>
37+
<WarningLevel>4</WarningLevel>
38+
</PropertyGroup>
39+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
40+
<OutputPath>bin\Debug\</OutputPath>
41+
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
42+
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
43+
<DebugSymbols>true</DebugSymbols>
44+
<DebugType>full</DebugType>
45+
<Optimize>false</Optimize>
46+
<DefineDebug>true</DefineDebug>
47+
<DefineTrace>true</DefineTrace>
48+
<ErrorReport>prompt</ErrorReport>
49+
<WarningLevel>4</WarningLevel>
50+
</PropertyGroup>
51+
<PropertyGroup>
52+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
53+
<!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
54+
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
55+
<VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
56+
</PropertyGroup>
57+
<Import Condition="'$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
58+
<Import Condition="'$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
59+
<ItemGroup>
60+
<Folder Include="Properties" />
61+
<Folder Include="dbo\" />
62+
<Folder Include="dbo\Tables\" />
63+
<Folder Include="dbo\Views\" />
64+
<Folder Include="dbo\User Defined Types\" />
65+
<Folder Include="Scripts" />
66+
<Folder Include="Scripts\LookupTables" />
67+
<Folder Include="Scripts\PreReleaseScripts" />
68+
<Folder Include="Scripts\ReleaseScripts" />
69+
<Folder Include="Scripts\Utility" />
70+
<Folder Include="dbo\Procs" />
71+
</ItemGroup>
72+
<ItemGroup>
73+
<Build Include="dbo\Tables\CustomRichText.sql" />
74+
<Build Include="dbo\Tables\CustomRichTextType.sql" />
75+
<Build Include="dbo\Tables\DatabaseMigration.sql" />
76+
<Build Include="dbo\Tables\FileResource.sql" />
77+
<Build Include="dbo\Tables\FileResourceMimeType.sql" />
78+
<Build Include="dbo\Tables\Role.sql" />
79+
<Build Include="dbo\Tables\User.sql" />
80+
<Build Include="dbo\User Defined Types\html.sql" />
81+
<None Include="Scripts\LookupTables\Script.PostDeployment.LookupTables.sql" />
82+
<None Include="Scripts\PreReleaseScripts\Script.PreDeployment.ReleaseScripts.sql" />
83+
<None Include="Scripts\ReleaseScripts\Script.PostDeployment.ReleaseScripts.sql" />
84+
<None Include="Scripts\Utility\Script.PostDeployment.Utility.sql" />
85+
<None Include="Scripts\LookupTables\dbo.Role.sql" />
86+
<None Include="Scripts\LookupTables\dbo.CustomRichTextType.sql" />
87+
<None Include="Scripts\LookupTables\dbo.FileResourceMimeType.sql" />
88+
<Build Include="dbo\Tables\Account.sql" />
89+
<Build Include="dbo\Tables\AccountParcelWaterYear.sql" />
90+
<Build Include="dbo\Tables\AccountReconciliation.sql" />
91+
<Build Include="dbo\Tables\AccountStatus.sql" />
92+
<Build Include="dbo\Tables\AccountUser.sql" />
93+
<Build Include="dbo\Tables\DisadvantagedCommunity.sql" />
94+
<Build Include="dbo\Tables\DisadvantagedCommunityStatus.sql" />
95+
<Build Include="dbo\Tables\geometry_columns.sql" />
96+
<Build Include="dbo\Tables\Offer.sql" />
97+
<Build Include="dbo\Tables\OfferStatus.sql" />
98+
<Build Include="dbo\Tables\OpenETGoogleBucketResponseEvapotranspirationData.sql" />
99+
<Build Include="dbo\Tables\OpenETSyncHistory.sql" />
100+
<Build Include="dbo\Tables\OpenETSyncResultType.sql" />
101+
<Build Include="dbo\Tables\Parcel.sql" />
102+
<Build Include="dbo\Tables\ParcelLayerGDBCommonMappingToParcelStagingColumn.sql" />
103+
<Build Include="dbo\Tables\ParcelLedger.sql" />
104+
<Build Include="dbo\Tables\ParcelLedgerEntrySourceType.sql" />
105+
<Build Include="dbo\Tables\ParcelStatus.sql" />
106+
<Build Include="dbo\Tables\ParcelTag.sql" />
107+
<Build Include="dbo\Tables\ParcelUpdateStaging.sql" />
108+
<Build Include="dbo\Tables\Posting.sql" />
109+
<Build Include="dbo\Tables\PostingStatus.sql" />
110+
<Build Include="dbo\Tables\PostingType.sql" />
111+
<Build Include="dbo\Tables\ScenarioArsenicContaminationLocation.sql" />
112+
<Build Include="dbo\Tables\ScenarioRechargeBasin.sql" />
113+
<Build Include="dbo\Tables\spatial_ref_sys.sql" />
114+
<Build Include="dbo\Tables\Tag.sql" />
115+
<Build Include="dbo\Tables\Trade.sql" />
116+
<Build Include="dbo\Tables\TradeStatus.sql" />
117+
<Build Include="dbo\Tables\TransactionType.sql" />
118+
<Build Include="dbo\Tables\UploadedGdb.sql" />
119+
<Build Include="dbo\Tables\WaterTradingScenarioWell.sql" />
120+
<Build Include="dbo\Tables\WaterTransfer.sql" />
121+
<Build Include="dbo\Tables\WaterTransferRegistration.sql" />
122+
<Build Include="dbo\Tables\WaterTransferRegistrationParcel.sql" />
123+
<Build Include="dbo\Tables\WaterTransferRegistrationStatus.sql" />
124+
<Build Include="dbo\Tables\WaterTransferType.sql" />
125+
<Build Include="dbo\Tables\WaterType.sql" />
126+
<Build Include="dbo\Tables\WaterYear.sql" />
127+
<Build Include="dbo\Tables\WaterYearMonth.sql" />
128+
<Build Include="dbo\Tables\Well.sql" />
129+
<Build Include="dbo\Views\vGeoServerAllParcels.sql" />
130+
<Build Include="dbo\Views\vGeoServerDisadvantagedCommunity.sql" />
131+
<Build Include="dbo\Views\vGeoServerScenarioArsenicContaminationLocation.sql" />
132+
<Build Include="dbo\Views\vGeoServerScenarioRechargeBasin.sql" />
133+
<Build Include="dbo\Views\vGeoServerWaterTradingScenarioWell.sql" />
134+
<Build Include="dbo\Views\vGeoServerWells.sql" />
135+
<Build Include="dbo\Views\vOpenETMostRecentSyncHistoryForYearAndMonth.sql" />
136+
<Build Include="dbo\Views\vParcelLayerUpdateDifferencesInAccountAssociatedWithParcelAndParcelGeometry.sql" />
137+
<Build Include="dbo\Views\vParcelLayerUpdateDifferencesInParcelsAssociatedWithAccount.sql" />
138+
<Build Include="dbo\Views\vParcelOwnership.sql" />
139+
<Build Include="dbo\Views\vPostingDetailed.sql" />
140+
<Build Include="dbo\Views\vUserDetailed.sql" />
141+
<Build Include="dbo\Procs\pLandOwnerUsageReport.sql" />
142+
<Build Include="dbo\Procs\pParcelWaterSupplyAndUsage.sql" />
143+
<Build Include="dbo\Procs\pUpdateParcelLayerAddParcelsUpdateAccountParcelAndUpdateParcelGeometry.sql" />
144+
<Build Include="dbo\Procs\pUpdateParcelMonthlyEvapotranspirationWithETData.sql" />
145+
<Build Include="dbo\Procs\pUpdateParcelUpdateStagingGeometryFromParcelGeometryText.sql" />
146+
<Build Include="Scripts\LookupTables\dbo.AccountStatus.sql" />
147+
<Build Include="Scripts\LookupTables\dbo.OfferStatus.sql" />
148+
<Build Include="Scripts\LookupTables\dbo.OpenETSyncResultType.sql" />
149+
<Build Include="Scripts\LookupTables\dbo.ParcelStatus.sql" />
150+
<Build Include="Scripts\LookupTables\dbo.PostingStatus.sql" />
151+
<Build Include="Scripts\LookupTables\dbo.PostingType.sql" />
152+
<Build Include="Scripts\LookupTables\dbo.TradeStatus.sql" />
153+
<Build Include="Scripts\LookupTables\dbo.WaterTransferRegistrationStatus.sql" />
154+
<Build Include="Scripts\LookupTables\dbo.WaterTransferType.sql" />
155+
</ItemGroup>
156+
<ItemGroup>
157+
<None Include="Rio.Database.publish.xml" />
158+
<None Include="Scripts\PreReleaseScripts\README.md" />
159+
<None Include="Scripts\ReleaseScripts\README.md" />
160+
</ItemGroup>
161+
<ItemGroup>
162+
<PostDeploy Include="Scripts\Script.PostDeployment.sql" />
163+
</ItemGroup>
164+
<ItemGroup>
165+
<PreDeploy Include="Scripts\Script.PreDeployment.sql" />
166+
</ItemGroup>
167+
<UsingTask TaskName="PostDeploymentGenerator" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
168+
<ParameterGroup>
169+
<releaseScriptFolder ParameterType="System.String" Required="true" />
170+
<releaseScriptFileName ParameterType="System.String" Required="true" />
171+
<projectName ParameterType="System.String" Required="true" />
172+
<title ParameterType="System.String" Required="true" />
173+
</ParameterGroup>
174+
<Task>
175+
<Code Type="Fragment" Language="cs"><![CDATA[
176+
var files = Directory.GetFiles(releaseScriptFolder, "*.sql");
177+
StringBuilder sb = new StringBuilder();
178+
sb.AppendLine("/*");
179+
sb.AppendLine(title + " Script");
180+
sb.AppendLine("--------------------------------------------------------------------------------------");
181+
sb.AppendLine("This file is generated on every build, DO NOT modify.");
182+
sb.AppendLine("--------------------------------------------------------------------------------------");
183+
sb.AppendLine("*/");
184+
sb.AppendLine("");
185+
sb.AppendLine("PRINT N'" + projectName + " - " + releaseScriptFileName +"';");
186+
sb.AppendLine("GO");
187+
sb.AppendLine("");
188+
foreach (var file in files.OrderBy(f => f))
189+
{
190+
if (file.Contains(releaseScriptFileName))
191+
{
192+
continue;
193+
}
194+
var fileName = file.Replace(releaseScriptFolder, "");
195+
sb.AppendLine(":r \"." + fileName + "\"");
196+
sb.AppendLine("GO");
197+
198+
}
199+
using (System.IO.StreamWriter file = new System.IO.StreamWriter(Path.Combine(releaseScriptFolder, releaseScriptFileName)))
200+
{
201+
file.WriteLine(sb.ToString()); // "sb" is the StringBuilder
202+
}
203+
]]></Code>
204+
</Task>
205+
</UsingTask>
206+
<Target Name="CustomBuildStep" BeforeTargets="BeforeBuild">
207+
<PostDeploymentGenerator projectName="$(MSBuildProjectName)" title="Post-Deployment" releaseScriptFolder="Scripts\\ReleaseScripts" releaseScriptFileName="Script.PostDeployment.ReleaseScripts.sql" />
208+
<PostDeploymentGenerator projectName="$(MSBuildProjectName)" title="Pre-Deployment" releaseScriptFolder="Scripts\\PreReleaseScripts" releaseScriptFileName="Script.PreDeployment.ReleaseScripts.sql" />
209+
<PostDeploymentGenerator projectName="$(MSBuildProjectName)" title="Lookup-Table" releaseScriptFolder="Scripts\\LookupTables" releaseScriptFileName="Script.PostDeployment.LookupTables.sql" />
210+
</Target>
211+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Lookup-Table Script
3+
--------------------------------------------------------------------------------------
4+
This file is generated on every build, DO NOT modify.
5+
--------------------------------------------------------------------------------------
6+
*/
7+
8+
PRINT N'Rio.Database - Script.PostDeployment.LookupTables.sql';
9+
GO
10+
11+
:r ".\dbo.AccountStatus.sql"
12+
GO
13+
:r ".\dbo.CustomRichTextType.sql"
14+
GO
15+
:r ".\dbo.FileResourceMimeType.sql"
16+
GO
17+
:r ".\dbo.OfferStatus.sql"
18+
GO
19+
:r ".\dbo.OpenETSyncResultType.sql"
20+
GO
21+
:r ".\dbo.ParcelStatus.sql"
22+
GO
23+
:r ".\dbo.PostingStatus.sql"
24+
GO
25+
:r ".\dbo.PostingType.sql"
26+
GO
27+
:r ".\dbo.Role.sql"
28+
GO
29+
:r ".\dbo.TradeStatus.sql"
30+
GO
31+
:r ".\dbo.WaterTransferRegistrationStatus.sql"
32+
GO
33+
:r ".\dbo.WaterTransferType.sql"
34+
GO
35+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
MERGE INTO dbo.AccountStatus AS Target
2+
USING (VALUES
3+
(1, 'Active', 'Active'),
4+
(2, 'Inactive', 'Inactive')
5+
)
6+
AS Source (AccountStatusID, AccountStatusName, AccountStatusDisplayName)
7+
ON Target.AccountStatusID = Source.AccountStatusID
8+
WHEN MATCHED THEN
9+
UPDATE SET
10+
AccountStatusName = Source.AccountStatusName,
11+
AccountStatusDisplayName = Source.AccountStatusDisplayName
12+
WHEN NOT MATCHED BY TARGET THEN
13+
INSERT (AccountStatusID, AccountStatusName, AccountStatusDisplayName)
14+
VALUES (AccountStatusID, AccountStatusName, AccountStatusDisplayName)
15+
WHEN NOT MATCHED BY SOURCE THEN
16+
DELETE;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
MERGE INTO dbo.CustomRichTextType AS Target
2+
USING (VALUES
3+
(1, 'HomePage', 'Home Page'),
4+
(2, 'Contact', 'Contact'),
5+
(3, 'FrequentlyAskedQuestions', 'Frequently Asked Questons'),
6+
(4, 'AboutGET', 'About GET'),
7+
(5, 'Disclaimer', 'Disclaimer'),
8+
(6, 'PlatformOverview', 'Platform Overview'),
9+
(7, 'MeasuringWaterUse', 'Measuring Water Use With OpenET'),
10+
(8, 'ConfigureWaterTypes', 'Configure Water Types'),
11+
(9, 'CreateWaterTransactions', 'Create Water Transactions'),
12+
(10, 'TrainingVideos', 'Training Videos'),
13+
(11, 'CreateUserProfile', 'Create User Profile'),
14+
(12, 'CreateUserProfileStepOne', 'Create User Profile Step One'),
15+
(13, 'CreateUserProfileStepTwo', 'Create User Profile Step Two'),
16+
(14, 'CreateUserProfileStepThree', 'Create User Profile Step Three'),
17+
(15, 'WaterAccountsAdd', 'Water Accounts Add'),
18+
(16, 'WaterAccountsAddLegalText', 'Water Accounts Add Legal Text'),
19+
(17, 'WaterAccountsInvite', 'Water Accounts Invite'),
20+
(18, 'ParcelList', 'Parcel List'),
21+
(19, 'OpenETIntegration', 'OpenET Integration'),
22+
(20, 'ParcelUpdateLayer', 'Parcel Update Layer'),
23+
(21, 'InactiveParcelList', 'Inactive Parcel List'),
24+
(22, 'AccountReconciliationReport', 'Account Reconciliation Report'),
25+
(23, 'ParcelLedgerCreate', 'Create New Transaction'),
26+
(24, 'ParcelLedgerBulkCreate', 'Create Bulk Transaction'),
27+
(25, 'ParcelLedgerCreateFromSpreadsheet', 'Create Transaction From Spreadsheet Upload'),
28+
(26, 'WebsiteFooter', 'Website Footer'),
29+
(28, 'PurchasedDescription', 'Purchased Water Description'),
30+
(29, 'SoldDescription', 'Sold Water Description'),
31+
(30, 'TagList', 'Tag List'),
32+
(31, 'BulkTagParcels', 'Bulk Tag Parcels'),
33+
(32, 'TransactionHistory', 'Transaction History')
34+
)
35+
AS Source (CustomRichTextTypeID, CustomRichTextTypeName, CustomRichTextTypeDisplayName)
36+
ON Target.CustomRichTextTypeID = Source.CustomRichTextTypeID
37+
WHEN MATCHED THEN
38+
UPDATE SET
39+
CustomRichTextTypeName = Source.CustomRichTextTypeName,
40+
CustomRichTextTypeDisplayName = Source.CustomRichTextTypeDisplayName
41+
WHEN NOT MATCHED BY TARGET THEN
42+
INSERT (CustomRichTextTypeID, CustomRichTextTypeName, CustomRichTextTypeDisplayName)
43+
VALUES (CustomRichTextTypeID, CustomRichTextTypeName, CustomRichTextTypeDisplayName)
44+
WHEN NOT MATCHED BY SOURCE THEN
45+
DELETE;

0 commit comments

Comments
 (0)