Changeset 030457bb3959…
Parent 957b10626f18…
by
Changes to 2 files · Browse files at 030457bb3959 Showing diff from parent 957b10626f18 Diff from another changeset...
|
|
@@ -54,7 +54,7 @@ allParamsSpecified = false;
}
}
-
+
/// <summary>
/// Run the migrator's console
/// </summary>
@@ -86,17 +86,17 @@ }
return 0;
}
-
+
/// <summary>
/// Runs the migrations.
/// </summary>
public void Migrate()
{
CheckArguments();
-
+
Migrator mig = GetMigrator();
- if(_migrateUp)
+ if (_migrateUp)
mig.MigrateUp();
else if (_migrateDown)
mig.MigrateDown();
@@ -105,38 +105,38 @@ else
mig.MigrateTo(_migrateTo);
}
-
+
/// <summary>
/// List migrations.
/// </summary>
public void List()
{
CheckArguments();
-
+
Migrator mig = GetMigrator();
int currentVersion = mig.CurrentVersion;
-
+
Console.WriteLine("Available migrations:");
foreach (Type t in mig.MigrationsTypes)
{
int v = Migrator.GetMigrationVersion(t);
Console.WriteLine("{0} {1} {2}",
- v == currentVersion ? "=>" : " ",
- v.ToString().PadLeft(3),
- Migrator.GetMigrationDescription(t)
- );
+ v == currentVersion ? "=>" : " ",
+ v.ToString().PadLeft(3),
+ Migrator.GetMigrationDescription(t)
+ );
}
}
-
+
public void Dump()
{
CheckArguments();
-
+
SchemaDumper dumper = new SchemaDumper(_provider, _connectionString);
-
+
dumper.DumpTo(_dumpTo);
}
-
+
/// <summary>
/// Show usage information and help.
/// </summary>
@@ -144,7 +144,7 @@ {
int tab = 17;
Version ver = Assembly.GetExecutingAssembly().GetName().Version;
-
+
Console.WriteLine("Database migrator - v{0}.{1}.{2}", ver.Major, ver.Minor, ver.Revision);
Console.WriteLine();
Console.WriteLine("usage:\nMigrator.Console.exe provider connectionString migrationsAssembly [options]");
@@ -161,11 +161,11 @@ Console.WriteLine();
Console.WriteLine("-up, -down, and -to options are mutually exclusive");
}
-
+
#region Private helper methods
private Assembly GetAssembly()
{
- return Assembly.LoadFrom(_migrationsAssembly);;
+ return Assembly.LoadFrom(_migrationsAssembly); ;
}
private Migration GetBeginMigration()
@@ -219,7 +219,7 @@ migrations.Sort(new MigrationTypeComparer(true));
return migrations;
}
-
+
private void CheckArguments()
{
if (_connectionString == null)
@@ -227,7 +227,7 @@ if (_migrationsAssembly == null)
throw new ArgumentException("Migrations assembly missing", "migrationsAssembly");
}
-
+
private Migrator GetMigrator()
{
GuidAttribute guidAttribute = (GuidAttribute)Attribute.GetCustomAttribute(GetAssembly(), typeof(GuidAttribute));
@@ -235,7 +235,7 @@ var logger = new Loggers.ConsoleLogger(_trace);
return new Migrator(_provider, _connectionString, GetGeneralMigrations(), GetBeginMigration(), GetEndMigration(), guidAttribute, logger);
}
-
+
private void ParseArguments(string[] argv)
{
for (int i = 0; i < argv.Length; i++)
|
@@ -31,7 +31,7 @@
namespace Migrator
{
- /// <summary>
+ /// <summary>
/// Migrations mediator.
/// </summary>
public class Migrator
@@ -75,7 +75,7 @@ public Migrator(string provider, string connectionString)
: this(CreateProvider(provider, connectionString), Assembly.GetExecutingAssembly(), new Log4NetLogger())
{ }
-
+
public Migrator(TransformationProvider provider, Assembly migrationAssembly, ILogger logger)
{
_provider = provider;
@@ -84,14 +84,14 @@
if (provider == null)
throw new ArgumentNullException("provider");
-
+
if (migrationAssembly == null)
{
_logger.Exception("Migration assembly not provided.", new ArgumentNullException("migrationAssembly"));
throw new Exception("Assembly not found");
}
- if(migrationAssembly != null)
+ if (migrationAssembly != null)
_logger.Log("Performing migrations for {0}", migrationAssembly.FullName);
// add all providers to the "all providers" list
@@ -104,7 +104,7 @@ }
this._allProviders.Add(_provider);
- GuidAttribute guid = (GuidAttribute)Attribute.GetCustomAttribute(migrationAssembly, typeof(GuidAttribute));
+ AssemblyGuid = (GuidAttribute)Attribute.GetCustomAttribute(migrationAssembly, typeof(GuidAttribute));
// only load the migrations for the given assembly
if (migrationAssembly != null)
@@ -202,7 +202,7 @@ }
}
#endregion
-
+
#region Static Methods
/// <summary>
/// Allow a migration to create a TransformationProvider to another database so it can migrate data from that database
@@ -362,7 +362,7 @@ this._logger.Started(CurrentVersion, toVersion);
/// Execute the Begin Migration
- if(goingUp)
+ if (goingUp)
InitializeMigration(BeginMigration).Up();
else
InitializeMigration(EndMigration).Down();
@@ -569,7 +569,7 @@ }
#endregion
- #region Helper methods
+ #region Helper methods
/// <summary>
/// Check for duplicated version in migrations.
/// </summary>
|
Loading...