en-US/about_PSql_Deploy.help.txt
about_PSql_Deploy ================= SHORT DESCRIPTION PSql.Deploy is a migration and seeding system for SQL Server, Azure SQL Database, and compatible databases. LONG DESCRIPTION The PSql.Deploy module provides cmdlets to deal with two core concepts: migrations and seeds. A migration is a SQL script that modifies the schema of a target database. A seed is a SQL script that populates a target database with data. Together, migrations and seeds provide a mechanism to perform database deployments in a controlled and repeatable manner. PSql.Deploy is designed to integrate with the PSql module if it is installed, but PSql is not required. :: Source Directory Structure :: PSql.Deploy expects migrations and seeds to have a specific filesystem layout. src\ The source directory: a set of migrations and │ seeds for one database design. The name can vary. │ ├─ Migrations\ Migrations. Required only if there are any migrations. │ │ │ ├─ 0001\ One migration. The name can vary. │ │ │ │ │ ├─ _Main.sql Top-level script for the migration. It can │ │ │ include other files with the :r directive. │ │ ├─ FileA.sql Example file included by _Main.sql. │ │ ├─ FileB.sql Example file included by _Main.sql. │ │ └─ ... More files, subdirectories, etc. │ │ │ └─ ... More migrations. │ ├─ Seeds\ Seeds. Required only if there are any seeds. │ │ │ ├─ TestData\ One seed. The name can vary. │ │ │ │ │ ├─ _Main.sql Top-level script for the seed. It can │ │ │ include other files with the :r directive. │ │ ├─ FileA.sql Example file included by _Main.sql. │ │ ├─ FileB.sql Example file included by _Main.sql. │ │ └─ ... More files, subdirectories, etc. │ │ │ └─ ... More seeds. │ └─ ... PSql.Deploy does not care about other files or directories present in the source directory. Given an arbitrary source directory, PSql.Deploy expects to find migrations in a Migrations subdirectory and seeds in a Seeds subdirectory. Within the Migrations and Seeds directories, each subdirectory containing a _Main.sql file is a migration or seed, respectively. The name of the subdirectory determines the name of the migration or seed. The _Main.sql file is a T-SQL script and is the entry point for the migration or seed. PSql.Deploy supports the SQLCMD features GO, $(…), :r, and :setvar, enabling authors to split migration and seed scripts across multiple files. PSql.Deploy also recognizes a few migration- and seed-specific directives. These are 'magic' comments that begin with --# but are ignored by other tools. See about_PSql_Deploy_Migrations and about_PSql_Deploy_Seeds for more details. :: Command Overview :: Get-SqlMigrations Lists migrations found in a source directory or applied to a target database. Invoke-SqlMigrations Applies outstanding migrations to one or more target databases. Invoke-SqlSeed Applies one or more seeds to one or more target databases. :: See Also :: - about_PSql_Deploy_Migrations - about_PSql_Deploy_Seeds - Get-SqlMigrations - Invoke-SqlMigrations - Invoke-SqlSeed - https://github.com/sharpjs/PSql.Deploy |