README.txt 3.0 KB

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