Skip to content

Commit

Permalink
Merge branch 'release/1.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
abbgrade committed Aug 19, 2024
2 parents 252b527 + 0e9ea60 commit 7f654bf
Show file tree
Hide file tree
Showing 16 changed files with 255 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-validation.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [ develop, bugfix/*, feature/*, release/* ]
branches: [ develop, bugfix/*, feature/*, release/*, hotfix/* ]
pull_request:
branches: [ develop ]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [ release/* ]
branches: [ release/*, hotfix/* ]
workflow_dispatch:

jobs:
Expand Down
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"cSpell.words": [
"dacpac",
"Filegroups",
"Hashtable",
"Nocheck",
"sqlproj",
"Ssdt",
"testdb"
Expand Down
15 changes: 15 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,20 @@
},
"dependsOn": ["Build", "Create Testdata"]
},
{
"label": "Test exclude AzureSql",
"group": "test",
"type": "shell",
"command": "Invoke-Pester -Configuration @{ Filter = @{ ExcludeTag = 'AzureSql' }}",
"options": {
"cwd": "test"
},
"problemMatcher": "$msCompile",
"presentation": {
"echo": false,
"showReuseMessage": false
},
"dependsOn": ["Build"]
},
]
}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.7.0] - 2024-08-13

### Changed

- Added support for views to `Get-DacColumn` command.
- Updated Microsoft.SqlServer.DacFx to 162.1.167.
- Updated System.Management.Automation to 7.2.16 and PowerShell 7.2.16.

### Added

- Added `Install-Package` parameter for IgnoreWithNocheckOnCheckConstraints, IgnoreWithNocheckOnForeignKeys and ScriptNewConstraintValidation.

## [1.6.0] - 2023-08-24

### Changed
Expand Down
30 changes: 30 additions & 0 deletions PsDac.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E3CF8094-3455-46A9-B9D3-FBBCA943E40A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PsDac", "src\PsDac\PsDac.csproj", "{1E0D293B-B68C-401E-988D-4B8CD72F5CB4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1E0D293B-B68C-401E-988D-4B8CD72F5CB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E0D293B-B68C-401E-988D-4B8CD72F5CB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E0D293B-B68C-401E-988D-4B8CD72F5CB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E0D293B-B68C-401E-988D-4B8CD72F5CB4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1E0D293B-B68C-401E-988D-4B8CD72F5CB4} = {E3CF8094-3455-46A9-B9D3-FBBCA943E40A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2D4E4A93-6CA1-487D-96A9-267F1FF4B072}
EndGlobalSection
EndGlobal
23 changes: 16 additions & 7 deletions docs/Get-DacColumn.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ schema: 2.0.0
# Get-DacColumn

## SYNOPSIS
Returns columns of a table.
Returns columns of a table or view.

## SYNTAX

```
Get-DacColumn [-Table] <TSqlObject> [[-Name] <String>] [<CommonParameters>]
Get-DacColumn -Object <TSqlObject> [[-Name] <String>] [<CommonParameters>]
```

## DESCRIPTION
Expand All @@ -30,6 +30,15 @@ Schema Name ObjectType
Application [Application].[Cities].[CityID] Microsoft.SqlServer.Dac.Model.ModelTypeClass
```

### Example 2
```
PS C:\> Import-DacModel -Path ./WideWorldImporters.dacpac | Get-DacView -Name '[Website].[Customers]' | Get-DacColumn -Name '[Website].[Customers].[CustomerID]'
Schema Name ObjectType
------ ---- ----------
Website [Website].[Customers].[CustomerID] Microsoft.SqlServer.Dac.Model.ModelTypeClass
```

## PARAMETERS

### -Name
Expand All @@ -47,17 +56,17 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -Table
Specifies the table to get the columns from.
The ObjectType must be Table.
### -Object
Specifies the table or view to get the columns from.
The ObjectType must be Table or View.
```yaml
Type: TSqlObject
Parameter Sets: (All)
Aliases:
Aliases: Table

Required: True
Position: 0
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
Expand Down
131 changes: 66 additions & 65 deletions docs/Install-DacPackage.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,13 @@ Installs the content of myDb.dacpac into database myDb on localdb and creates th

## PARAMETERS

### -DatabaseName
Specifies the database to install the package into.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
### -ExcludeObjectTypes
List of ObjectType, that must not be installed.
### -AcceptPossibleDataLoss
{{ Fill AcceptPossibleDataLoss Description }}

```yaml
Type: ObjectType[]
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Accepted values: Aggregates, ApplicationRoles, Assemblies, AssemblyFiles, AsymmetricKeys, BrokerPriorities, Certificates, ColumnEncryptionKeys, ColumnMasterKeys, Contracts, DatabaseOptions, DatabaseRoles, DatabaseTriggers, Defaults, ExtendedProperties, ExternalDataSources, ExternalFileFormats, ExternalTables, Filegroups, Files, FileTables, FullTextCatalogs, FullTextStoplists, MessageTypes, PartitionFunctions, PartitionSchemes, Permissions, Queues, RemoteServiceBindings, RoleMembership, Rules, ScalarValuedFunctions, SearchPropertyLists, SecurityPolicies, Sequences, Services, Signatures, StoredProcedures, SymmetricKeys, Synonyms, Tables, TableValuedFunctions, UserDefinedDataTypes, UserDefinedTableTypes, ClrUserDefinedTypes, Users, Views, XmlSchemaCollections, Audits, Credentials, CryptographicProviders, DatabaseAuditSpecifications, DatabaseEncryptionKeys, DatabaseScopedCredentials, Endpoints, ErrorMessages, EventNotifications, EventSessions, LinkedServerLogins, LinkedServers, Logins, MasterKeys, Routes, ServerAuditSpecifications, ServerRoleMembership, ServerRoles, ServerTriggers, ExternalStreams, ExternalStreamingJobs, DatabaseWorkloadGroups, WorkloadClassifiers, ExternalLibraries, ExternalLanguages

Required: False
Position: Named
Expand All @@ -68,27 +52,11 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -Package
Specifies the package to install into the database.
```yaml
Type: DacPackage
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```
### -Service
Specifies the server to install the package to.
Default is the latest connected service.
### -CommandTimeout
{{ Fill CommandTimeout Description }}
```yaml
Type: DacServices
Type: Int32
Parameter Sets: (All)
Aliases:

Expand All @@ -99,23 +67,8 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -UpgradeExisting
{{ Fill upgradeExisting Description }}
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### -CommandTimeout
{{ Fill CommandTimeout Description }}
### -DatabaseLockTimeout
{{ Fill DatabaseLockTimeout Description }}
```yaml
Type: Int32
Expand All @@ -129,18 +82,18 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -DatabaseLockTimeout
{{ Fill DatabaseLockTimeout Description }}
### -DatabaseName
Specifies the database to install the package into.
```yaml
Type: Int32
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
Expand All @@ -151,6 +104,7 @@ Accept wildcard characters: False
Type: ObjectType[]
Parameter Sets: (All)
Aliases:
Accepted values: Aggregates, ApplicationRoles, Assemblies, AssemblyFiles, AsymmetricKeys, BrokerPriorities, Certificates, ColumnEncryptionKeys, ColumnMasterKeys, Contracts, DatabaseOptions, DatabaseRoles, DatabaseTriggers, Defaults, ExtendedProperties, ExternalDataSources, ExternalFileFormats, ExternalTables, Filegroups, Files, FileTables, FullTextCatalogs, FullTextStoplists, MessageTypes, PartitionFunctions, PartitionSchemes, Permissions, Queues, RemoteServiceBindings, RoleMembership, Rules, ScalarValuedFunctions, SearchPropertyLists, SecurityPolicies, Sequences, Services, Signatures, StoredProcedures, SymmetricKeys, Synonyms, Tables, TableValuedFunctions, UserDefinedDataTypes, UserDefinedTableTypes, ClrUserDefinedTypes, Users, Views, XmlSchemaCollections, Audits, Credentials, CryptographicProviders, DatabaseAuditSpecifications, DatabaseEncryptionKeys, DatabaseScopedCredentials, Endpoints, ErrorMessages, EventNotifications, EventSessions, LinkedServerLogins, LinkedServers, Logins, MasterKeys, Routes, ServerAuditSpecifications, ServerRoleMembership, ServerRoles, ServerTriggers, ExternalStreams, ExternalStreamingJobs, DatabaseWorkloadGroups, WorkloadClassifiers, ExternalLibraries, ExternalLanguages

Required: False
Position: Named
Expand Down Expand Up @@ -279,6 +233,22 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -ExcludeObjectTypes
List of ObjectType, that must not be installed.
```yaml
Type: ObjectType[]
Parameter Sets: (All)
Aliases:
Accepted values: Aggregates, ApplicationRoles, Assemblies, AssemblyFiles, AsymmetricKeys, BrokerPriorities, Certificates, ColumnEncryptionKeys, ColumnMasterKeys, Contracts, DatabaseOptions, DatabaseRoles, DatabaseTriggers, Defaults, ExtendedProperties, ExternalDataSources, ExternalFileFormats, ExternalTables, Filegroups, Files, FileTables, FullTextCatalogs, FullTextStoplists, MessageTypes, PartitionFunctions, PartitionSchemes, Permissions, Queues, RemoteServiceBindings, RoleMembership, Rules, ScalarValuedFunctions, SearchPropertyLists, SecurityPolicies, Sequences, Services, Signatures, StoredProcedures, SymmetricKeys, Synonyms, Tables, TableValuedFunctions, UserDefinedDataTypes, UserDefinedTableTypes, ClrUserDefinedTypes, Users, Views, XmlSchemaCollections, Audits, Credentials, CryptographicProviders, DatabaseAuditSpecifications, DatabaseEncryptionKeys, DatabaseScopedCredentials, Endpoints, ErrorMessages, EventNotifications, EventSessions, LinkedServerLogins, LinkedServers, Logins, MasterKeys, Routes, ServerAuditSpecifications, ServerRoleMembership, ServerRoles, ServerTriggers, ExternalStreams, ExternalStreamingJobs, DatabaseWorkloadGroups, WorkloadClassifiers, ExternalLibraries, ExternalLanguages

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -LongRunningCommandTimeout
{{ Fill LongRunningCommandTimeout Description }}
Expand All @@ -294,11 +264,27 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -Variables
{{ Fill Variables Description }}
### -Package
Specifies the package to install into the database.
```yaml
Type: Hashtable
Type: DacPackage
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```
### -Service
Specifies the server to install the package to.
Default is the latest connected service.
```yaml
Type: DacServices
Parameter Sets: (All)
Aliases:

Expand All @@ -309,14 +295,29 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -AcceptPossibleDataLoss
{{ Fill AcceptPossibleDataLoss Description }}
### -UpgradeExisting
{{ Fill upgradeExisting Description }}
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### -Variables
{{ Fill Variables Description }}
```yaml
Type: Hashtable
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Expand Down
11 changes: 7 additions & 4 deletions src/PsDac/GetColumnCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ namespace PsDac
[OutputType(typeof(TSqlObject))]
public class GetColumnCommand : PSCmdlet
{
[Alias("Table")]
[Parameter(
Position = 0,
Mandatory = true,
ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty()]
public TSqlObject Table { get; set; }
public TSqlObject Object { get; set; }

[Parameter(
Position = 1,
Expand All @@ -25,16 +26,18 @@ protected override void ProcessRecord()
{
base.ProcessRecord();

if (Table.ObjectType.Name != "Table") {
throw new System.ArgumentException("Invalid Table type", Table.ObjectType.Name);
if (Object.ObjectType.Name != "Table" && Object.ObjectType.Name != "View") {
throw new System.ArgumentException("Invalid Table or View type", Object.ObjectType.Name);
}

bool hasNameFilter = Name != null;
if ( hasNameFilter ) {
WriteVerbose($"Filter columns on name '{Name}'");
}

foreach (var item in Table.GetReferencedRelationshipInstances(Microsoft.SqlServer.Dac.Model.Table.Columns, DacQueryScopes.Default)) {
var relationship = Object.ObjectType.Name == "Table" ? Microsoft.SqlServer.Dac.Model.Table.Columns : Microsoft.SqlServer.Dac.Model.View.Columns;

foreach (var item in Object.GetReferencedRelationshipInstances(relationship, DacQueryScopes.Default)) {
if ( ( !hasNameFilter || item.ObjectName.ToString() == Name ))
{
var result = new PSObject(item.Object);
Expand Down
Loading

0 comments on commit 7f654bf

Please sign in to comment.