Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Database Project with Change Tracking #926

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

keithnicholson
Copy link

Adds a database project to the samples folder. It generates a database with Change Tracking enabled, including tracking set on the tables

@keithnicholson
Copy link
Author

keithnicholson commented Sep 22, 2023 via email

@Charles-Gagnon
Copy link
Contributor

@dzsquared @kisantia @Benjin to help look over the sqlproj

But what would probably be best is to make this an SDK-style sqlproj - that is the newer format that will reduce a lot of the clutter the old style has. Let us know if you have any questions and we'd be glad to help!

@keithnicholson
Copy link
Author

@Charles-Gagnon

I had not looked into this yet. I'll give it a try and push an update.

@dzsquared
Copy link
Contributor

@keithnicholson - to be clear, the SDK-style projects aren't supported in Visual Studio yet so you may want to hold off if you're really attached to using Visual Studio instead of VS Code or Azure Data Studio for the database work. Otherwise, SDK-style SQL projects are pretty nifty and much easier for use with dotnet etc.

https://github.com/microsoft/DacFx/blob/main/src/Microsoft.Build.Sql/docs/Converting-Existing.md

Your sqlproj file would condense down to:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0">
  <Sdk Name="Microsoft.Build.Sql" Version="0.1.12-preview" />
  <PropertyGroup>
    <Name>DatabaseProjectAFSqlExtensions</Name>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectVersion>4.1</ProjectVersion>
    <ProjectGuid>{34897831-8d8d-4ca6-b1c2-8ea1535b4c05}</ProjectGuid>
    <DSP>Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider</DSP>
    <DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
    <IsChangeTrackingOn>True</IsChangeTrackingOn>
    <ChangeTrackingRetentionPeriod>7</ChangeTrackingRetentionPeriod>
  </PropertyGroup>
</Project>

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered using the newer and simpler SDK-style .sqlproj format supported in Azure Data Studio? It'd really clean this file up!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Others have mentioned it. I had not seen it as an option until today. I'll be doing it tomorrow.

@keithnicholson
Copy link
Author

I have created a SDK-style sqlproj locally, yet I have trouble building it. I found an issue on the project that I have added my comments at : microsoft/DacFx#330.

I'll update my PR later.

@chlafreniere
Copy link
Contributor

I have created a SDK-style sqlproj locally, yet I have trouble building it. I found an issue on the project that I have added my comments at : microsoft/DacFx#330.

I'll update my PR later.

Thanks @keithnicholson! I've worked with the owner of the sql build sdk, and he's taking a look.

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest just putting this in https://github.com/Azure/azure-functions-sql-extension/tree/main/samples/Database and using the scripts there. That way we don't have to remember to go update these ones as well when we add/modify anything.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I update the PR with the SDK-style, you will see that I named the folder differently. When it gets committed, I think I will suggest removing the prior sql scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants