protected async Task Deprecate(List <SchemaVersionJournalEntry> deprecated, string version)
 {
     foreach (var script in deprecated)
     {
         var entry = new SchemaVersionJournalEntry
         {
             Name    = script.Name,
             Type    = "Deprecated",
             Applied = DateTime.Now,
             Version = version,
             Hash    = script.Hash
         };
         using (var step = Output.MiniProfiler.Step($"Journaling {script.Name}"))
         {
             await Transaction.ExecuteAsync("INSERT INTO SchemaVersionJournal (Version, [Type], Name, Applied, Hash) values (@Version, @Type, @Name, @Applied, @Hash)", entry);
         }
     }
 }
        protected async Task RunScripts(IEnumerable <IScript> scripts, string version = null)
        {
            var orderedScripts = scripts.OrderBy(x => x.Type.IsJournaled);

            if (version == null)
            {
                orderedScripts = orderedScripts
                                 .ThenBy(x => x.Type.IsJournaled ?
                                         ProjectSettings.MigrationVersioning.Version(x) : null,
                                         ProjectSettings.MigrationVersioning.VersionComparer);
            }
            orderedScripts = orderedScripts.ThenBy(x => x.Name);
            foreach (var script in orderedScripts)
            {
                Logger.Log($"Executing script '{script.Name}'", "info");
                var sameTransaction = Transaction;
                using (var step = Output.MiniProfiler.Step(script.Name))
                {
                    await script.ApplyAsync(sameTransaction, ScriptContext);
                }

                if (script.Type.IsJournaled)
                {
                    var nextVersion = version ?? ProjectSettings.MigrationVersioning.Version(script).Value;
                    var nextSchemaJournalVersion = new SchemaVersionJournalEntry
                    {
                        Name    = script.Name,
                        Type    = script.Type.Name,
                        Applied = DateTime.Now,
                        Version = nextVersion,
                        Hash    = script.GetHash()
                    };
                    using (var step = Output.MiniProfiler.Step($"Journaling {script.Name}"))
                    {
                        await sameTransaction.ExecuteAsync($"INSERT INTO SchemaVersionJournal (Version, [Type], Name, Applied, Hash) values (@Version, @Type, @Name, @Applied, @Hash)", nextSchemaJournalVersion);
                    }
                }
            }
        }