-
Notifications
You must be signed in to change notification settings - Fork 1
MSBuild Runner Options
The MSBuild task for FluentMigrator is a way to run migrations from MSBuild build scripts and is very similar to the Command Line Runner Options and Nant Runner Options. Some options have multiple names e.g. Database or DatabaseType
Example:
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Migrate">
<UsingTask TaskName="FluentMigrator.MSBuild.Migrate"
AssemblyFile="./lib/FluentMigrator.MSBuild.dll"/>
<Target Name="Migrate" >
<Message Text="Starting FluentMigrator Migration"/>
<Migrate Database="sqlserver2008"
Connection="server=.\SQLEXPRESS;uid=testfm;pwd=test;Trusted_Connection=yes;database=FluentMigrator"
Target="./Migrations/bin/Debug/Migrations.dll"
Output="True"
OutputFilename="generated.sql">
</Migrate>
</Target>
<Target Name="MigrateRollbackAll" >
<Message Text="Starting FluentMigrator Rollback All"/>
<Migrate Database="sqlserver2008"
Connection="server=.\SQLEXPRESS;uid=testfm;pwd=test;Trusted_Connection=yes;database=FluentMigrator"
Target="./Migrations/bin/Debug/Migrations.dll"
Task="rollback:all">
</Migrate>
</Target>
</Project>
The path to the assembly containing the migrations you want to execute.
The kind of database you are migrating against. Available choices are:
- sqlserver2000
- sqlserver2005
- sqlserver2008
- sqlserver2012
- sqlserverce
- sqlserver
- mysql
- postgres
- oracle
- sqlite
- jet
The connection string to the server and database you want to execute your migrations against. This can be a full connection string or the name of the connection string stored in a config file.
When specifying a named connection string, FluentMigrator searchs for it in this order:
1. The specified config file via --connectionStringConfigPath
parameter
2. Target assembly’s config file
3. Machine.config config file
The path of the config file where the connection string named by is found. If not specified, it defaults to lookup order specified --connectionString
parameter documentation
The task you want FluentMigrator to perform. Available choices are:
migrate:up
-
migrate
(same as migrate:up) migrate:down
rollback
rollback:toversion
rollback:all
listmigrations
Default is ‘migrate’.
Show the SQL statements generated and execution time in the console. Default is false. This is a boolean switch so it can be set to "True"
or "False"
.
Output generated SQL to a file. Default is no output. Use outputFilename
to control the filename, otherwise [assemblyname].sql is the default. This is a boolean switch so it can be set to "True"
or "False"
.
The name of the file to output the generated SQL to. The output option must be included for output to be saved to the file. The file will be placed in the same directory as the MSBuild script was executed from.
The namespace contains the migrations you want to run. Default is all migrations found within the Target Assembly will be run.
Whether migrations in nested namespaces should be included. Used in conjunction with the namespace option. This is a boolean switch so it can be set to "True"
or "False"
.
The number of versions to rollback if the task is ‘rollback’. Default is 1.
Only output the SQL generated by the migration – do not execute it. Default is false. This is a boolean switch so it can be set to "True"
or "False"
.
The specific version to migrate. Default is 0, which will run all migrations.
The profile to run after executing migrations.
Overrides the default SqlCommand timeout of 30 seconds.
The directory to load SQL scripts specified by migrations from.
Filters migrations to be run based on tags. See Filter migrations run based on Tags
A string argument that can be used in a migration. See ApplicationContext: Passing parameters to Migrations
The default transaction is one transaction per migration so the default for this switch is false. Run migrations in one transaction per session (task) instead. This is a boolean switch so it does not take a value. It can be set to "True"
or "False"
.
- Getting FluentMigrator
- How to create a Migration
- Fluent Interface
- Migration Runners
- Use inbuilt database functions when setting the default value
- Sql Server Specific Extensions
- Raw Sql Helper for inserting data
- Auto Reversing Migrations
- Resharper File Template
- Transaction Modes for the Migration Runner
- ApplicationContext: Passing parameters to Migrations
- Dealing with Multiple Database Types
- Filter migrations run based on Tags
- Enforce migration version numbering rules
- Create custom metadata for the VersionInfo table