-
Notifications
You must be signed in to change notification settings - Fork 75
/
README.txt
99 lines (80 loc) · 2.96 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
= Migrator DotNet
Database Migrations implemented in .NET.
Supports rolling up and rolling back of migrations.
A way to integrate database change management into your regular development and automation processes.
The migrations themselves are implemented in code and can be mostly done in a database independent way.
Licensed under MPL 1.1 : http://www.mozilla.org/MPL/
== Supported Database
* MySQL (5.0, 5.1)
* PostgreSQL
* SQLite (tested on Mono)
* SQL Server (2000, 2005)
* SQL Server CE (3.5)
== Untested Databases but in there
* Oracle
== Supported Modes
* MSBuild Task
* NAnt Task
* Console Application
= Development
== Compiling
To build from source:
nant build
== Testing
To run tests:
nant test
You should have a database installed and setup:
* MySql
* SQL Server
* Oracle
* PostgreSQL
* or you can use SQLite with no setup
You can Test on each engine or change those by changing the 'exclude' properties in a nant build
file called 'local.properties'. To change the database connection strings see config\app.config. You
can make your own local version called 'local.config' to override these
== SQL Server CE
To use SQL Server CE, you will need the proper tools installed. The current DLL that we are testing
against is the 3.5 version.
As of this writing you can download the installer for the SQL CE Runtime at:
http://www.microsoft.com/downloads/details.aspx?&FamilyID=7849b34f-67ab-481f-a5a5-4990597b0297&DisplayLang=en
We have not confirmed if this will build on Mono yet. But it almost definitely won't run because SQL CE uses PInvoke
internally.
= Usage
1. Add bin/Migrator.Framework.dll to you project references
- All of the other DLLs are only needed for actually running the migrations.
2. Create a class for your migration like:
using Migrator.Framework;
[Migration(1)]
public class MyMigration : Migration
{
public override void Up()
{
// Create stuff
}
public override void Down()
{
// Remove the same stuff
}
}
3. Compile your migrations and run the console (Migrator.Console.exe) or use the migrator
NAnt or MSBuild tasks:
NAnt:
<loadtasks assembly=".../Migrator.NAnt.dll" />
<target name="migrate" description="Migrate the database" depends="build">
<property name="version" value="-1" overwrite="false" />
<migrate
provider="MySql|PostgreSQL|SqlServer"
connectionstring="Database=MyDB;Data Source=localhost;User Id=;Password=;"
migrations="bin/MyProject.dll"
to="${version}" />
</target>
MSBuild:
<PropertyGroup>
<MigratorTasksPath>$(MSBuildProjectDirectory)\migrator</MigratorTasksPath>
</PropertyGroup>
<Import Project="$(MigratorTasksPath)\Migrator.Targets" />
<Target name="Migrate" DependsOnTargets="Build">
<Migrate Provider="SqlServer"
Connectionstring="Database=MyDB;Data Source=localhost;User Id=;Password=;"
Migrations="bin/MyProject.dll"/>
</Target>