Fluent Migrator - Chris Farrell

Download Report

Transcript Fluent Migrator - Chris Farrell

Fluent Migrator
Chris Farrell
Quick Solutions
What is it?
•
•
•
•
•
Sean Chambers, Nate Kohari, Justin Etheredge
.Net Schema Migration Tool
Fluent Interface
Write.Schema.Transformations.With.Net
Supports:
– SQL Server, MySQL, PostGres, Oracle, Sqlite,Jet
Why
•
•
•
•
•
•
Devs sharing the same DB == Headaches
Product Updates from n-th Version to Current
Apply Dev updates to Production
Testing Legacy Versions
Create Testing Databases
Multi-Targeted(create SQL Lite, SQL, Etc)
What Can FM do?
•
•
•
•
•
Update any ? Version to current version
Create an update SQL Script
Create a specific version of the database
Rollback migration(s)
Execute SQL Scripts
Syntax
• libs\FluentMigrator\Migrate --verbose=true -db=sqlserver2008 -c="Data Source=localhost;Initial
Catalog=Fanug;Integrated Security=SSPI" --timeout=1500 a="src\FluentMigratorDemo\bin\Debug\FluentMigratorDemo
.dll" %1 %2 %3 %4
• Export: -output -outputFilename="test.sql“
• Migrate Up: -t=migrate:up
• Rollback: -t=rollback %1
• Rollback All: -t=rollback:all
• Rollback to Nth Version: -t=rollback:toversion --version=%1
Links
• Official Repo
– https://github.com/schambers/fluentmigrator
– .Net 3.5, 32 bit SQLite
• My Repo
– https://github.com/chrispfarrell/fluentmigrator
• Jeffs Repo
– https://github.com/walkercoderanger
DEMO
•
•
•
•
•
•
•
Create Table
Alter Table
Execute SQL command
Execute SQL Script
Export SQL script
Create New DB
Create Specific Version