Exemple #1
0
        public bool Execute(ISession session, MigrationResources resources)
        {
            _logger.Debug("Initialize database versioner");
            var versioner = new Versioner(session, new Logger <Version>());

            _logger.Debug("Initialize executor");
            var executor = new Executor(session, versioner, new Logger <Executor>());

            _logger.Debug("Execute migrations");
            return(executor.Execute(resources));
        }
        public MigrationResources Find()
        {
            var resources = new MigrationResources();

            var ensureLoaded = Type.GetType("Skimur.Tasks.Migrations.Empty, Skimur.Tasks");

            if (ensureLoaded == null)
                throw new Exception("Couldn't find the Migrations.dll");

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                foreach (var type in assembly.GetTypes())
                {
                    if (typeof (Migration).IsAssignableFrom(type) && !type.IsAbstract)
                    {
                        resources.Add(Activator.CreateInstance(type) as Migration);
                    }
                }
            }

            return resources;
        }
        public MigrationResources Find()
        {
            var resources = new MigrationResources();

            var ensureLoaded = Type.GetType("Skimur.Tasks.Migrations.Empty, Skimur.Tasks");

            if (ensureLoaded == null)
            {
                throw new Exception("Couldn't find the Migrations.dll");
            }

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                foreach (var type in assembly.GetTypes())
                {
                    if (typeof(Migration).IsAssignableFrom(type) && !type.IsAbstract)
                    {
                        resources.Add(Activator.CreateInstance(type) as Migration);
                    }
                }
            }

            return(resources);
        }
Exemple #4
0
 public bool Execute(MigrationResources resources)
 {
     _logger.Debug("Start executing migrations");
     return(resources.Migrations.OrderBy(x => x.Version).All(Execute));
 }
Exemple #5
0
 public bool Execute(MigrationResources resources)
 {
     _logger.Debug("Start executing migrations");
     return resources.Migrations.OrderBy(x => x.Version).All(Execute);
 }