Example #1
0
 private MigrationScriptBuilder(int i)
 {
     _key = i.ToString();
     _script = i.ToScript();
     _migration = i.ToMigration();
 }
Example #2
0
 public MigrationScriptBuilder WithoutMigration()
 {
     _migration = null;
     return this;
 }
Example #3
0
 public MigrationScriptBuilder WithMigration(Migration m)
 {
     _key = m.ScriptName;
     _migration = m;
     return this;
 }
Example #4
0
 private bool Apply(Script script, bool syncOnly, int padding)
 {
     try
     {
         var migrationRecord = new Migration(script.ScriptName, script.Checksum, DateTime.UtcNow, script.Content);
         if (!syncOnly)
         {
             Logger.Info($"{script.ScriptName} - applying... ".PadRight(padding));
             _database.ApplyMigration(migrationRecord);
         }
         else
         {
             Logger.Info($"{script.ScriptName} - inserting... ".PadRight(padding));
             _database.Insert(migrationRecord);
         }
         Logger.Ok();
     }
     catch (Exception e)
     {
         Logger.Error("ERROR: " + e.Message);
         return false;
     }
     return true;
 }
Example #5
0
 public void ApplyMigration(Migration migration)
 {
     RunInTransaction(migration.Content);
     Insert(migration);
 }
Example #6
0
 public void Insert(Migration item)
 {
     _db.Execute(_dbQueries.InsertStatement, item);
 }