-
Notifications
You must be signed in to change notification settings - Fork 0
Nant Runner Options
The Nant task for FluentMigrator is a way to run migrations from Nant build scripts and is very similar to the Command Line Runner Options.
Example:
<?xml version="1.0" encoding="UTF-8" ?>
<project name="fluentmigrator" xmlns="http://nant.sf.net/release/0.85/nant.xsd" default="migrate">
<loadtasks assembly="packages/FluentMigrator.1.0.2.0/tools/FluentMigrator.NAnt.dll" />
<target name="migrate" description="Migrate the database to the latest version">
<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"
/>
</target>
<target name="migrate-rollback-all" description="Migrates the database back to original state prior to applying migrations">
<migrate
database="sqlserver2008"
connection="server=.\SQLEXPRESS;uid=testfm;pwd=test;Trusted_Connection=yes;database=FluentMigrator"
target="./Migrations/bin/Debug/Migrations.dll"
task="rollback:all"
/>
</target>
</project>
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.
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 nant 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
- 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