full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Migrations/00000000000001_RivetInitializeDatabase.ps1
00000000000001_RivetInitializeDatabase.ps1
function Push-Migration { Invoke-Ddl -Query @' if not exists (select * from sys.schemas where name = 'rivet') exec sp_executesql N'create schema [rivet] authorization [dbo]' if not exists (select * from sys.schemas s join sys.database_principa...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Extras/Complete-MigrationOperation.ps1
Complete-MigrationOperation.ps1
function Complete-MigrationOperation { param( [Parameter(Mandatory=$true)] [Rivet.Migration] # The migration the operation is part of. $Migration, [Parameter(Mandatory=$true)] [Rivet.Operation] # The operation which was just applied. $Ope...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Extras/Start-MigrationOperation.ps1
Start-MigrationOperation.ps1
function Start-MigrationOperation { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [Rivet.Migration] # The migration the operation is part of. $Migration, [Parameter(Mandatory=$true)] [Rivet.Operation] # The operation which is about to...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Extras/Convert-Migration.ps1
Convert-Migration.ps1
<# .SYNOPSIS Demonstrates how to use the Rivet object model to convert migrations to standalone SQL scripts. .DESCRIPTION Sometimes you can't run your migration scripts directly against a database. In these situations, it is useful to be able to grab the SQL from your migrations and convert them into a different...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Invoke-Rivet.ps1
Invoke-Rivet.ps1
function Invoke-Rivet { [CmdletBinding(SupportsShouldProcess=$True)] param( [Parameter(Mandatory=$true,ParameterSetName='New')] [Switch] # Creates a new migration. $New, [Parameter(Mandatory=$true,ParameterSetName='Push')] [Switch] # Appl...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Write-RivetError.ps1
Write-RivetError.ps1
function Write-RivetError { param( [Parameter(Mandatory=$true)] [string] # The error message to display. $Message, [Parameter(Mandatory=$true)] [Exception] # The exception being reported. $Exception, [Parameter(...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/New-MigrationObject.ps1
New-MigrationObject.ps1
function New-MigrationObject { <# .SYNOPSIS Creates a new `Rivet.Migration` object, suitable for passing to `Invoke-Migration` function. .DESCRIPTION All migrations in Rivet should be represented as an object. Each object should inherit from `Rivet.Migration`. This method returns an empt...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Disconnect-Database.ps1
Disconnect-Database.ps1
function Disconnect-Database { param( ) if( $Connection -and $Connection.State -ne [Data.ConnectionState]::Closed ) { $Connection.Close() } }
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Invoke-Query.ps1
Invoke-Query.ps1
filter Invoke-Query { <# .SYNOPSIS Executes a SQL query against the database. .DESCRIPTION The `Invoke-Query` function runs arbitrary queries aginst the database. Queries are split on `GO` statements, and each query is sent individually to the database. By default, rows are...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Get-RivetConfig.ps1
Get-RivetConfig.ps1
function Get-RivetConfig { <# .SYNOPSIS Gets the configuration to use when running Rivet. .DESCRIPTION Rivet will look in the current directory for a `rivet.json` file. .LINK about_Rivet_Configuration .EXAMPLE Get-RivetConfig Looks in the current directory ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Connect-Database.ps1
Connect-Database.ps1
function Connect-Database { param( [Parameter(Mandatory=$true)] [string] # The SQL Server instance to connect to. $SqlServerName, [Parameter(Mandatory=$true)] [string] # The database to connect to. $Database, [U...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Get-Migration.ps1
Get-Migration.ps1
function Get-Migration { <# .SYNOPSIS Gets the migrations for all or specific databases. .DESCRIPTION The `Get-Migration` function returns `Rivet.Migration` objects for all the migrations in all or specific databases. With no parameters, looks in the current directory for a `rivet.json` fi...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/New-Migration.ps1
New-Migration.ps1
function New-Migration { <# .SYNOPSIS Creates a new migration script. .DESCRIPTION Creates a migration script with a given name. The script is prefixed with the current timestamp (e.g. yyyyMMddHHmmss). The script is created in `$Path\$Database\Migrations`. #> param( ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Invoke-MigrationOperation.ps1
Invoke-MigrationOperation.ps1
function Invoke-MigrationOperation { <# .SYNOPSIS Runs the SQL created by a `Rivet.Migration` object. .DESCRIPTION All Rivet migrations are described by instances of `Rivet.Migration` objects. These objects eventually make their way here, at which point they are converted to SQL, and exec...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Export-Row.ps1
Export-Row.ps1
<# .SYNOPSIS Export rows from a database as a migration where those rows get added using the `Add-Row` operation. .DESCRIPTION When getting your database working with Rivet, you may want to get some data exported into an initial migration. This script does that. .EXAMPLE Export-Row -SqlServerName .\Rivet -Da...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Test-Migration.ps1
Test-Migration.ps1
function Test-Migration { <# .SYNOPSIS Tests if a migration was applied to the database. .DESCRIPTION Returns `true` if a migration with the given ID has already been applied. `False` otherwise. .EXAMPLE Test-Migration -ID 20120211235838 Returns `True` if a ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Get-MigrationFile.ps1
Get-MigrationFile.ps1
function Get-MigrationFile { <# .SYNOPSIS Gets the migration script files. #> [CmdletBinding(DefaultParameterSetName='External')] [OutputType([IO.FileInfo])] param( [Parameter(Mandatory=$true)] [Rivet.Configuration.Configuration] # The configuration to us...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Initialize-Database.ps1
Initialize-Database.ps1
function Initialize-Database { <# .SYNOPSIS Intializes the database so that it can be migrated by Rivet. #> [CmdletBinding()] param( [Parameter(Mandatory=$true)] [Rivet.Configuration.Configuration] $Configuration ) Set-StrictMode -Version 'Latest' ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Import-Plugin.ps1
Import-Plugin.ps1
function Import-Plugin { <# .SYNOPSIS Loads any plugins. #> [CmdletBinding()] param( [Parameter(Mandatory=$true)] # The path to load the plugins from. $Path ) Set-StrictMode -Version 'Latest' if( -not (Test-Path -Path $Path -PathType Contain...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Update-Database.ps1
Update-Database.ps1
function Update-Database { <# .SYNOPSIS Applies a set of migrations to the database. .DESCRIPTION By default, applies all unapplied migrations to the database. You can reverse all migrations with the `Down` switch. .EXAMPLE Update-Database -Path C:\Projects\Rivet\Datab...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Convert-FileInfoToMigration.ps1
Convert-FileInfoToMigration.ps1
function Convert-FileInfoToMigration { <# .SYNOPSIS Converts a `System.IO.FileInfo` object containing a migration into a `Rivet.Operation` object. #> [CmdletBinding()] [OutputType([Rivet.Migration])] param( [Parameter(Mandatory=$true)] [Rivet.Configuration.Configu...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Split-SqlBatchQuery.ps1
Split-SqlBatchQuery.ps1
function Split-SqlBatchQuery { <# .SYNOPSIS Splits a SQL batch query into individual queries. .DESCRIPTION `Split-SqlBatchQuery` takes a batch query and splits it by the `GO` statements it contains. `GO` statements inside comments and strings are ignored. It does not use regular expression...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Merge-Migration.ps1
Merge-Migration.ps1
function Merge-Migration { <# .SYNOPSIS Creates a cumulative set of operations from migration scripts. .DESCRIPTION The `Merge-Migration` functions creates a cumulative set of migrations from migration scripts. If there are multiple operations across one or more migration scripts that touc...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Enable-Constraint.ps1
Enable-Constraint.ps1
function Enable-Constraint { <# .SYNOPSIS Enable a check or foreign key constraint. .DESCRIPTION The `Enable-Constraint` operation enables a check or foreign key constraint on a table. Only check and foreign key constraints can be enabled/disabled. .LINK Disable-Constra...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-RowGuidCol.ps1
Add-RowGuidCol.ps1
function Add-RowGuidCol { <# .SYNOPSIS Adds the `rowguidcol` property to a column in a table. .DESCRIPTION The `Add-RowGuidCol` operation adds the `rowguidcol` property to a `uniqueidentifier` column in a table. A table can only have one `rowguidcol` column. If a table has an existing `row...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-UserDefinedFunction.ps1
Add-UserDefinedFunction.ps1
function Add-UserDefinedFunction { <# .SYNOPSIS Creates a new user-defined function. .DESCRIPTION Creates a new user-defined function. .EXAMPLE Add-UserDefinedFunction -SchemaName 'rivet' 'One' 'returns tinyint begin return 1 end' Creates a user-defined function that retu...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-CheckConstraint.ps1
Remove-CheckConstraint.ps1
function Remove-CheckConstraint { <# .SYNOPSIS Removes a check constraint from a table. .DESCRIPTION The `Remove-CheckConstraint` operation removes a check constraint from a table. Check constraints add validation for data in columns. .EXAMPLE Remove-CheckConstraint 'Migr...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-UserDefinedFunction.ps1
Remove-UserDefinedFunction.ps1
function Remove-UserDefinedFunction { <# .SYNOPSIS Removes a user-defined function. .DESCRIPTION Removes a user-defined function. Will throw an exception and rollback the migration if the user-defined function doesn't exist. By default, the user-defined function is assumed ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-View.ps1
Add-View.ps1
function Add-View { <# .SYNOPSIS Creates a new view. .DESCRIPTION Creates a new view. .EXAMPLE Add-View -SchemaName 'rivet' 'ReadMigrations' 'AS select * from rivet.Migrations' Creates a view to read all the migrations from Rivet's Migrations table. Don't do this in rea...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-StoredProcedure.ps1
Remove-StoredProcedure.ps1
function Remove-StoredProcedure { <# .SYNOPSIS Removes a stored procedure. .DESCRIPTION Removes a stored procedure. Will throw an exception and rollback the migration if the stored procedure doesn't exist. By default, the stored procedure is assumed to be in the `dbo` schem...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Disable-Constraint.ps1
Disable-Constraint.ps1
function Disable-Constraint { <# .SYNOPSIS Disable a check of foreign key constraint on a table. .DESCRIPTION The `Disable-Constraint` operation disables a check or foreign key constraint on a table. Only check and foreign key constraints can be enabled/disabled. .LINK ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-Schema.ps1
Add-Schema.ps1
function Add-Schema { <# .SYNOPSIS Creates a new schema. .DESCRIPTION The `Add-Schema` operation creates a new schema in a database. It does so in an idempotent way, i.e. it only creates the schema if it doesn't exist. .EXAMPLE Add-Schema -Name 'rivetexample' Creates th...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-UniqueKey.ps1
Add-UniqueKey.ps1
function Add-UniqueKey { <# .SYNOPSIS Creates a UNIQUE constraint on the specified column and table. .DESCRIPTION Creates a UNIQUE constraint on the specified column and table. You can use UNIQUE constraints to make sure that no duplicate values are entered in specific columns that do...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-StoredProcedure.ps1
Add-StoredProcedure.ps1
function Add-StoredProcedure { <# .SYNOPSIS Creates a new stored procedure. .DESCRIPTION Creates a new stored procedure. .EXAMPLE Add-StoredProcedure -SchemaName 'rivet' 'ReadMigrations' 'AS select * from rivet.Migrations' Creates a stored procedure to read the migrations ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-CheckConstraint.ps1
Add-CheckConstraint.ps1
function Add-CheckConstraint { <# .SYNOPSIS Add a check constraint to a table. .DESCRIPTION Check constraints add validation for data in columns. .EXAMPLE Add-CheckConstraint 'Migrations' 'CK_Migrations_MigrationID' 'MigrationID > 0' Demonstrates how to add a c...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-DataType.ps1
Remove-DataType.ps1
function Remove-DataType { <# .SYNOPSIS Drops a user-defined datatype. .DESCRIPTION Handles all three datatypes: alias, CLR, and table. If the datatype is in use, you'll get an error. Make sure to remove/alter any objects that reference the type first. .LINK Add-DataTyp...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Update-Table.ps1
Update-Table.ps1
function Update-Table { <# .SYNOPSIS Adds new columns or alters existing columns on an existing table. .DESCRIPTION The `Update-Table` operation adds, updates, and removes columns from a table. Columns are added, then updated, then removed. The new columns for the table should be ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Update-ExtendedProperty.ps1
Update-ExtendedProperty.ps1
function Update-ExtendedProperty { <# .SYNOPSIS Updates an object's extended property. .DESCRIPTION SQL Server has a special stored procedure for updating extended property metatdata about an object. Unfortunately, it has a really clunky interface. This function is an attempt to wrap `...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Rename-Index.ps1
Rename-Index.ps1
function Rename-Index { <# .SYNOPSIS Renames an index. .DESCRIPTION SQL Server ships with a stored procedure which is used to rename certain objects. This operation wraps that stored procedure. Use `Rename-Column` to rename a column. Use `Rename-DataType` to rename a data t...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-Row.ps1
Remove-Row.ps1
function Remove-Row { <# .SYNOPSIS Removes a row from a table. .DESCRIPTION To specify which columns to insert into the new row, pass a hashtable as a value to the `Column` parameter. This hashtable should have keys that map to column names, and the value of each key will be used a...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-DataType.ps1
Add-DataType.ps1
function Add-DataType { <# .SYNOPSIS Creates an alias or user-defined type. .DESCRIPTION There are three different user-defined data types. The first is an alias, from a name you choose to a system datatype. The second is an assembly type, which uses a type stored in a .NET assembly. T...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Rename-Object.ps1
Rename-Object.ps1
function Rename-Object { <# .SYNOPSIS Renames objects (e.g. tables, constraints, keys). .DESCRIPTION This function wraps the `sp_rename` stored procedure, and can be used to rename objects tracked in `sys.objects`: * Tables * Functions * Synonyms * Constraints...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-ForeignKey.ps1
Add-ForeignKey.ps1
function Add-ForeignKey { <# .SYNOPSIS Adds a foreign key to an existing table that doesn't have a foreign key constraint. .DESCRIPTION Adds a foreign key to a table. The table/column that the foreign key references must have a primary key. If the table already has a foreign key, make sure...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-Table.ps1
Remove-Table.ps1
function Remove-Table { <# .SYNOPSIS Removes a table from a database. .DESCRIPTION You can't get any of the data back, so be careful. .EXAMPLE Remove-Table -Name 'Coffee' Removes the `Coffee` table from the database. #> param( # The name of the table w...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-Trigger.ps1
Remove-Trigger.ps1
function Remove-Trigger { <# .SYNOPSIS Deletes a new trigger. .DESCRIPTION Deletes an existing trigger. .LINK New-Trigger. .EXAMPLE Remove-Trigger 'PrintMessage' Removes the `PrintMessage` trigger. #> param( [Parameter(Mand...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Invoke-Ddl.ps1
Invoke-Ddl.ps1
function Invoke-Ddl { <# .SYNOPSIS Executes a DDL statement against the database. .DESCRIPTION The `Invoke-Ddl` function is used to update the structure of a database when none of Rivet's other operations will work. .EXAMPLE Invoke-Ddl -Query 'create table rivet.Migrati...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-PrimaryKey.ps1
Remove-PrimaryKey.ps1
function Remove-PrimaryKey { <# .SYNOPSIS Removes a primary key from a table. .DESCRIPTION The `Remove-PrimaryKey` operation removes a primary key from a table. .EXAMPLE Remove-PrimaryKey 'Cars' -Name 'Car_PK' Demonstrates how to remove a primary key whose name is differ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-ExtendedProperty.ps1
Remove-ExtendedProperty.ps1
function Remove-ExtendedProperty { <# .SYNOPSIS Drops an extended property for a schema, table, or column. .DESCRIPTION SQL Server has a special stored procedure for removing extended property metatdata about an object. Unfortunately, it has a really clunky interface. This function is ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Update-StoredProcedure.ps1
Update-StoredProcedure.ps1
function Update-StoredProcedure { <# .SYNOPSIS Updates an existing stored procedure. .DESCRIPTION Updates an existing stored procedure. .LINK https://msdn.microsoft.com/en-us/library/ms189762.aspx .EXAMPLE Update-StoredProcedure -SchemaName 'rivet' 'ReadMigrations' 'A...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Update-Row.ps1
Update-Row.ps1
function Update-Row { <# .SYNOPSIS Updates a row of data in a table. .DESCRIPTION To specify which columns in a row to update, pass a hashtable as a value to the `Column` parameter. This hashtable should have keys that map to column names, and the value of each key will be used to updat...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-Description.ps1
Remove-Description.ps1
function Remove-Description { <# .SYNOPSIS Removes the `MS_Description` extended property for a table or column. .DESCRIPTION The `sys.sp_dropextendedproperty` stored procedure is used to remove a table/column's description (i.e. the `MS_Description` extended property), but the syntax is w...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Update-UserDefinedFunction.ps1
Update-UserDefinedFunction.ps1
function Update-UserDefinedFunction { <# .SYNOPSIS Updates an existing user-defined function. .DESCRIPTION Updates an existing user-defined function. .LINK https://msdn.microsoft.com/en-us/library/ms186967.aspx .EXAMPLE Update-UserDefinedFunction -SchemaName 'rivet' ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-DefaultConstraint.ps1
Add-DefaultConstraint.ps1
function Add-DefaultConstraint { <# .SYNOPSIS Creates a Default constraint to an existing column .DESCRIPTION The DEFAULT constraint is used to insert a default value into a column. The default value will be added to all new records, if no other value is specified. .LINK Add...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-UniqueKey.ps1
Remove-UniqueKey.ps1
function Remove-UniqueKey { <# .SYNOPSIS Removes the Unique Constraint from the database .DESCRIPTION Removes the Unique Constraint from the database. .EXAMPLE Remove-UniqueKey 'Cars' -Name 'YearUK' Demonstrates how to remove a unique key whose name is different than the...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-PrimaryKey.ps1
Add-PrimaryKey.ps1
function Add-PrimaryKey { <# .SYNOPSIS Adds a primary key to an existing table that doesn't have a primary key. .DESCRIPTION Adds a primary key to a table. If the table already has a primary key, make sure to remove it with `Remove-PrimaryKey`. .LINK Remove-PrimaryKey ....
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Update-Description.ps1
Update-Description.ps1
function Update-Description { <# .SYNOPSIS Updates the `MS_Description` extended property of a table or column. .DESCRIPTION The `sys.sp_updateextendedproperty` stored procedure is used to update a table/column's description (i.e. the `MS_Description` extended property), but the syntax is ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Update-CodeObjectMetadata.ps1
Update-CodeObjectMetadata.ps1
function Update-CodeObjectMetadata { <# .SYNOPSIS Updates the metadata for a stored procedure, user-defined function, view, trigger, etc. .DESCRIPTION SQL Server has a stored procedure, `sys.sp_refreshsqlmodule`, which will refresh/update a the objects used by a code object (stored procedu...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Disable-ForeignKey.ps1
Disable-ForeignKey.ps1
function Disable-ForeignKey { <# .SYNOPSIS OBSOLETE. Use `Disable-Constraint` instead. .DESCRIPTION OBSOLETE. Use `Disable-Constraint` instead. .EXAMPLE Disable-Constraint 'SourceTable' 'FK_SourceID_ReferenceTable' Demonstrates that `Disable-ForeignKey` is obso...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Rename-Column.ps1
Rename-Column.ps1
function Rename-Column { <# .SYNOPSIS Renames a column. .DESCRIPTION SQL Server ships with a stored procedure which is used to rename certain objects. This operation wraps that stored procedure. Use `Rename-DataType` to rename a data type. Use `Rename-Index` to rename an ind...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-RowGuidCol.ps1
Remove-RowGuidCol.ps1
function Remove-RowGuidCol { <# .SYNOPSIS Remove the `rowguidcol` property from a column in a table. .DESCRIPTION The `Remove-RowGuidCol` operation removes the `rowguidcol` property from a `uniqueidentifier` column in a table. The `Remove-RowGuidCol` operation was added in Rivet 0.7...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-Table.ps1
Add-Table.ps1
function Add-Table { <# .SYNOPSIS Creates a new table in the database. .DESCRIPTION The column's for the table should be created and returned in a script block, which is passed as the value of the `Column` parameter. For example, Add-Table 'Suits' { Int 'id' -Ident...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-DefaultConstraint.ps1
Remove-DefaultConstraint.ps1
function Remove-DefaultConstraint { <# .SYNOPSIS Removes a default constraint from a table. .DESCRIPTION The `Remove-DefaultConstraint` operation removes a default constraint from a table. .EXAMPLE Remove-DefaultConstraint 'Cars' -Name 'Cars_Year_DefaultConstraint' Demon...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-Synonym.ps1
Add-Synonym.ps1
function Add-Synonym { <# .SYNOPSIS Creates a synonym. .DESCRIPTION SQL Server lets you create synonyms so you can reference an object with a different name, or reference an object in another database with a local name. .LINK http://technet.microsoft.com/en-us/library/ms1775...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Stop-Migration.ps1
Stop-Migration.ps1
function Stop-Migration { <# .SYNOPSIS Stops a migration from getting poppped. .DESCRIPTION The `Stop-Migration` operation stops a migration from getting popped. When put in your migration's `Pop-Migration` function, the migration will fail when someone attempts to pop it. Use this operati...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-Row.ps1
Add-Row.ps1
function Add-Row { <# .SYNOPSIS Inserts a row of data in a table. .DESCRIPTION To specify which columns to insert into the new row, pass a hashtable as a value to the `Column` parameter. This hashtable should have keys that map to column names, and the value of each key will be used as ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Update-View.ps1
Update-View.ps1
function Update-View { <# .SYNOPSIS Updates an existing view. .DESCRIPTION Updates an existing view. .LINK https://msdn.microsoft.com/en-us/library/ms173846.aspx .EXAMPLE Update-View -SchemaName 'rivet' 'ReadMigrations' 'AS select * from rivet.Migrations' Upd...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Update-Trigger.ps1
Update-Trigger.ps1
function Update-Trigger { <# .SYNOPSIS Updates an existing trigger. .DESCRIPTION Updates an existing trigger. .LINK https://msdn.microsoft.com/en-us/library/ms176072.aspx .LINK Add-Trigger Remove-Trigger .EXAMPLE Update-Trigger 'PrintMes...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-Schema.ps1
Remove-Schema.ps1
function Remove-Schema { <# .SYNOPSIS Removes a schema. .EXAMPLE Remove-Schema -Name 'rivetexample' Drops/removes the `rivetexample` schema. #> [CmdletBinding()] param( [Parameter(Mandatory=$true)] [Alias('SchemaName')] [string] # T...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-Index.ps1
Remove-Index.ps1
function Remove-Index { <# .SYNOPSIS Removes an index from a table. .DESCRIPTION The `Remove-Index` operation removes an index from a table. .EXAMPLE Remove-Index 'Cars' -Name 'YearIX' Demonstrates how to drop an index #> [CmdletBinding(DefaultParameterSetName=...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-ForeignKey.ps1
Remove-ForeignKey.ps1
function Remove-ForeignKey { <# .SYNOPSIS Removes a foreign key from an existing table that has a foreign key. .DESCRIPTION Removes a foreign key to a table. .EXAMPLE Remove-ForeignKey 'Cars' -Name 'FK_Cars_Year' Demonstrates how to remove a foreign key that has a name dif...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-View.ps1
Remove-View.ps1
function Remove-View { <# .SYNOPSIS Removes a view. .DESCRIPTION Removes a view. Will throw an exception and rollback the migration if the view doesn't exist. By default, the view is assumed to be in the `dbo` schema. Use the `Schema` parameter to specify a different schem...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Enable-ForeignKey.ps1
Enable-ForeignKey.ps1
function Enable-ForeignKey { <# .SYNOPSIS OBSOLETE. Use `Enable-Constraint` instead. .DESCRIPTION OBSOLETE. Use `Enable-Constraint` instead. .EXAMPLE Enable-Constraint 'TAbleName', 'FK_ForeignKeyName' Demonstrates that `Enable-ForeignKey` is obsolete and you sh...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-Description.ps1
Add-Description.ps1
function Add-Description { <# .SYNOPSIS Adds the `MS_Description` extended property to a table or column. .DESCRIPTION The `sys.sp_addextendedproperty` stored procedure is used to set a table/column's description (i.e. the `MS_Description` extended property), but the syntax is weird. This...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-Trigger.ps1
Add-Trigger.ps1
function Add-Trigger { <# .SYNOPSIS Creates a new trigger. .DESCRIPTION Creates a new trigger. If updating an existing trigger, use `Remove-Trigger` to remove it first, then `New-Trigger` to re-create it. .LINK Remove-Trigger. .EXAMPLE Add-Trigger 'PrintM...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Rename-DataType.ps1
Rename-DataType.ps1
function Rename-DataType { <# .SYNOPSIS Renames data types. .DESCRIPTION This function wraps the `sp_rename` stored procedure, and can be used to rename `USERDATATYPE` types. Use `Rename-Index` to rename an index. Use `Rename-Column` to rename a column. Use `Rename-Object` to ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Add-ExtendedProperty.ps1
Add-ExtendedProperty.ps1
function Add-ExtendedProperty { <# .SYNOPSIS Adds an extended property for a schema, table, view or column. .DESCRIPTION SQL Server has a special stored procedure for adding extended property metatdata about an object. Unfortunately, it has a really clunky interface. This function is a...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Remove-Synonym.ps1
Remove-Synonym.ps1
function Remove-Synonym { <# .SYNOPSIS Drops a synonym. .DESCRIPTION Drops an existing synonym. If the synonym doesn't exist, you'll get an error. .LINK http://technet.microsoft.com/en-us/library/ms174996.aspx .EXAMPLE Remove-Synonym -Name 'Buzz' ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Operations/Invoke-SqlScript.ps1
Invoke-SqlScript.ps1
function Invoke-SqlScript { <# .SYNOPSIS Runs a SQL script file as part of a migration. .DESCRIPTION The SQL script is split on GO statements, which must be by themselves on a line, e.g. select * from sys.tables GO select * from sys.views GO ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-CharColumn.ps1
New-CharColumn.ps1
function New-CharColumn { <# .SYNOPSIS Creates a column object representing an Char datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table -State 'Addresses' -Column { Char 'State' 2 } ## ALIASES * Char...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-VarBinaryColumn.ps1
New-VarBinaryColumn.ps1
function New-VarBinaryColumn { <# .SYNOPSIS Creates a column object representing an VarBinary datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'Images' { VarBinary 'Bits' 8000 } ## ALIASES * VarBi...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-UniqueIdentifierColumn.ps1
New-UniqueIdentifierColumn.ps1
function New-UniqueIdentifierColumn { <# .SYNOPSIS Creates a column object representing an UniqueIdentifier datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'WithUUID' { UniqueIdentifier 'ColumnName' } ##...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-NCharColumn.ps1
New-NCharColumn.ps1
function New-NCharColumn { <# .SYNOPSIS Creates a column object representing an NChar datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table -State 'Addresses' -Column { NChar 'State' 2 } ## ALIASES * N...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-DateTimeColumn.ps1
New-DateTimeColumn.ps1
function New-DateTimeColumn { <# .SYNOPSIS Creates a column object representing an DateTime datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'Orders' { DateTime 'OrderedAt' } ## ALIASES * DateTime...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-SmallDateTimeColumn.ps1
New-SmallDateTimeColumn.ps1
function New-SmallDateTimeColumn { <# .SYNOPSIS Creates a column object representing an SmallDateTime datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'Orders' { SmallDateTime 'OrderedAt' } ## ALIASES ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-RealColumn.ps1
New-RealColumn.ps1
function New-RealColumn { <# .SYNOPSIS Creates a column object representing an Real datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'Items' { Real 'Price' } ## ALIASES * Real .EXAMPLE ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-DateColumn.ps1
New-DateColumn.ps1
function New-DateColumn { <# .SYNOPSIS Creates a column object representing an Date datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'Members' { Date 'Birthday' } ## ALIASES * Date .EXAMPLE...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-TimeColumn.ps1
New-TimeColumn.ps1
function New-TimeColumn { <# .SYNOPSIS Creates a column object representing an Time datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'WithTime' { Time 'ColumnName' } ## ALIASES * Time .EXAM...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-HierarchyIDColumn.ps1
New-HierarchyIDColumn.ps1
function New-HierarchyIDColumn { <# .SYNOPSIS Creates a column object representing an HierarchyID datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'FamilyTree' { HierarchyID 'Father' } ## ALIASES ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-DateTimeOffsetColumn.ps1
New-DateTimeOffsetColumn.ps1
function New-DateTimeOffsetColumn { <# .SYNOPSIS Creates a column object representing an DateTimeOffset datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'Orders' { DateTimeOffset 'OrderedAt' } ## ALIASES ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-IntColumn.ps1
New-IntColumn.ps1
function New-IntColumn { <# .SYNOPSIS Creates a column object representing an Int datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'Items' { Int 'Quantity' } ## ALIASES * Int .EXAMPLE ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-TinyIntColumn.ps1
New-TinyIntColumn.ps1
function New-TinyIntColumn { <# .SYNOPSIS Creates a column object representing an TinyInt datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'WithTintyInt' { TinyInt 'ColumnName' } ## ALIASES * Tiny...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-FloatColumn.ps1
New-FloatColumn.ps1
function New-FloatColumn { <# .SYNOPSIS Creates a column object representing a `float` datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'Items' { Float 'Price' } ## ALIASES * Float .EXAMPLE...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-SmallMoneyColumn.ps1
New-SmallMoneyColumn.ps1
function New-SmallMoneyColumn { <# .SYNOPSIS Creates a column object representing an SmallMoney datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'Items' { SmallMoney 'Price' } ## ALIASES * SmallMo...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-BinaryColumn.ps1
New-BinaryColumn.ps1
function New-BinaryColumn { <# .SYNOPSIS Creates a column object representing an Binary datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'Images' { Binary 'Bits' 256 } ## ALIASES * Binary ....
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-XmlColumn.ps1
New-XmlColumn.ps1
function New-XmlColumn { <# .SYNOPSIS Creates a column object representing an Xml datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table -Name 'WebConfigs' -Column { Xml 'WebConfig' -XmlSchemaCollection 'webconfigschema' ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-BigIntColumn.ps1
New-BigIntColumn.ps1
function New-BigIntColumn { <# .SYNOPSIS Creates a column object representing an BigInt datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'Migrations' { BigInt 'MigrationID' } ## ALIASES * BigInt ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-BitColumn.ps1
New-BitColumn.ps1
function New-BitColumn { <# .SYNOPSIS Creates a column object representing an Bit datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'Items' { Bit 'IsAvailable' } ## ALIASES * Bit .EXAMPLE ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-VarCharColumn.ps1
New-VarCharColumn.ps1
function New-VarCharColumn { <# .SYNOPSIS Creates a column object representing an VarChar datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table -Name 'WithVarCharColumn' -Column { VarChar 'ColumnName' 50 } ## ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-SmallIntColumn.ps1
New-SmallIntColumn.ps1
function New-SmallIntColumn { <# .SYNOPSIS Creates a column object representing an SmallInt datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'Items' { SmallInt 'Quantity' } ## ALIASES * SmallInt ...
PowerShellCorpus/PowerShellGallery/Rivet/0.8.1/Functions/Columns/New-RowVersionColumn.ps1
New-RowVersionColumn.ps1
function New-RowVersionColumn { <# .SYNOPSIS Creates a column object representing an RowVersion datatype. .DESCRIPTION Use this function in the `Column` script block for `Add-Table`: Add-Table 'WithUUID' { RowVersion 'ColumnName' } ## ALIASES *...