Skip to content

About

SQL Server Audit, Migrations and Archiving built on modern PowerShell 7 and Microsoft.Data.SqlClient

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Fast1data.SqlServer

Fast1data.SqlServer is a PowerShell module for SQL Server administration and deployment workflows. It currently provides:

  • Fast1 Audit — resumable import of SQL Server Audit (.sqlaudit) files into a SQL Server database.
  • Fast1 Migration — ordered, checksum-protected execution of SQL Server migration scripts.
  • Fast1 Archiving — resumable, batch-based archiving and purging between SQL Server databases.

Requirements

  • PowerShell 7.6 or later
  • SQL Server PowerShell module SqlServer module
  • An x64 Windows, Linux, or macOS runtime
  • Network and database permissions required by the selected feature

The module bundles Microsoft.Data.SqlClient for these runtime identifiers:

  • win-x64
  • linux-x64
  • osx-x64

Install from PowerShell Gallery

  • Simply run
Install-Module -Name Fast1data.SqlServer

Install from source

  • Clone the repository
  • Build the bundled SQL client libraries if lib is not already populated:
.\build\build.ps1
  • Import the module directly from the repository:
Import-Module .\Fast1data.SqlServer\Fast1data.SqlServer.psd1 -Force
  • Confirm that the public commands are available:
Get-Command -Module Fast1data.SqlServer

Features

SQL Server Audit import

Use Invoke-Fast1Audit to discover audit files, import new records, and resume from stored file offsets.

See Fast1Audit.md for database setup, permissions, ignore rules, and usage.

SQL Server migrations

Use Invoke-Fast1Migration to execute scripts in configured order, record their checksums, preview changes with -WhatIf, and selectively ignore or force scripts.

See Fast1Migration.md for schema setup, configuration, execution behavior, and CI/CD examples.

SQL Server archiving

Use Invoke-Fast1Archiving to copy and optionally purge configured table data in resumable batches.

See Fast1Archiving.md for prerequisites, database setup, table-group configuration, limitations, and usage.

Help

PowerShell command help is available after importing the module:

Get-Help Invoke-Fast1Audit -Full
Get-Help Invoke-Fast1Migration -Full
Get-Help Invoke-Fast1Archiving -Full

Tests

All suites in Fast1data.SqlServer/tests end in .Tests.ps1. Files containing .Integration. require live SQL Server or audit resources; platform-specific suites include .Linux. or .Windows. before the suffix.

Run the suites that do not require live services from the repository root:

$testPaths = Get-ChildItem ./Fast1data.SqlServer/tests/*.Tests.ps1 |
	Where-Object Name -NotLike '*.Integration.*' |
	Select-Object -ExpandProperty FullName
Invoke-Pester -Path $testPaths -Output Detailed

Migration command tests are in Migration.Tests.ps1, phase validation is in Migration.Phase.Tests.ps1, and live SQL cases are in Migration.Integration.Tests.ps1. Review each integration suite's connection and fixture settings before selecting it. See the feature guides for prerequisites.

Maintaining private loaders

Fast1data.SqlServer/private/shared/Load.ps1 is the only shared behavior list. Root and private/archiving/ArchivingModel.psm1 dot-source it independently, giving each module its own private functions. Root explicitly selects audit, migration (including checksum and relative-path helpers), and the archiving adapter; the model selects comparison/delay helpers and retains its local functions and classes. Ordinary function files contain behavior; their loaders supply dependencies.

Root bootstraps SqlClient before loading shared behavior and the declaration-only private/archiving/Load.ps1, then loads the archiving adapter and public commands. Direct model-first imports require explicit SqlClient bootstrap before parsing model classes. After repairing a missing or corrupt required dependency, retry in a fresh PowerShell process because class definitions persist within a process. The three public commands, runtime requirements, configuration, and persisted data contracts are unchanged. See the loader validation guide for cold imports, fault isolation, and source/package checks.

License

This project is licensed under the MIT License.

About

SQL Server Audit, Migrations and Archiving built on modern PowerShell 7 and Microsoft.Data.SqlClient

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages