fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
564 stars 144 forks source link

Added MsSqlSsdt.Tests.fsproj back (fixed build issues). #780

Closed JordanMarr closed 1 year ago

JordanMarr commented 1 year ago

Proposed Changes

This is a standalone unit test project that I think is useful for anyone working on the SSDT feature because it can build and run on its own and provides an easy way to unit test changes.

I had added the project during initial development of the SSDT provider, but I think it was probably broken at some point after changes and removed. This PR simplifies it and fixes the issues so that it builds again and adds it to the tests sln for others to use. (I think it might be useful for @MMagueta to put some unit tests here for #779.)

Plus, it would be good to have at least some unit test coverage for the SSDT provider in general, and this would be a good place for that.

Thorium commented 1 year ago

To build the SSDT properly in Mac (and also VS2022), the sqlproj should probably be replaces with fsproj file containing something like this:

<Project Sdk="MSBuild.Sdk.SqlProj/2.0.0">
 <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <SuppressTSqlWarnings>71558,71502</SuppressTSqlWarnings>
    <SqlServerVersion>SqlAzure</SqlServerVersion>
 </PropertyGroup>
 <PropertyGroup>
  <BundledNETCoreAppTargetFrameworkVersion>5.0</BundledNETCoreAppTargetFrameworkVersion>
  <IgnorePermissions>True</IgnorePermissions>
  <IgnoreUserSettingsObjects>True</IgnoreUserSettingsObjects>
  <IgnoreLoginSids>True</IgnoreLoginSids>
  <IgnoreRoleMembership>True</IgnoreRoleMembership>
  <IgnoreUserLoginMappings>True</IgnoreUserLoginMappings>
  <ValidateCasingOnIdentifiers>False</ValidateCasingOnIdentifiers>
  <ExcludeObjectTypes>Users,Logins,RoleMembership,ServerRoleMembership,Permissions,Assemblies</ExcludeObjectTypes>
  <TreatVerificationErrorsAsWarnings>True</TreatVerificationErrorsAsWarnings>
  <!-- <OutputPath>something here</OutputPath>-->
  <AssemblyName>database</AssemblyName>
  <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
 </PropertyGroup>
 <ItemGroup>
  <Content Include="**\*.sql" />
 </ItemGroup>
</Project>
JordanMarr commented 1 year ago

Updated the SSDT project for Mac build compatibility.

I had to drop some of the tests that utilized the data context (UserDefinedDataTypes.fs and TestQueries.fs) due to weird type provider build errors that I couldn't resolve. But at least the parser tests work, which is better than no tests. I'm sure someone else could get it working, but it's been long enough that I'm starting to forget all the little tricks of building this codebase.

JordanMarr commented 1 year ago

Can't get the SSDT project to work properly. 🤷‍♂️

Thorium commented 1 year ago

I can look into it...