Example #1
0
        /// <summary>
        /// A parancs végrehajtása
        /// </summary>
        protected override void DoRun()
        {
            SqlConnection  connection;
            SqlTransaction transaction;

            GetConnection(SqlInstance, SqlDatabase, UserName, Password, out connection, out transaction);

            CreateMetadataSchema(connection, transaction);

            var dependencyGraph = new DependencyGraph();

            foreach (var database in _databases)
            {
                DatabaseVersion  currentVersion;
                HashSet <string> existingSchemaNames;

                GetMetadata(connection, transaction, database.Name, out currentVersion, out existingSchemaNames);

                dependencyGraph.BuildUpgradePath(
                    database.Name,
                    currentVersion,
                    database.Version,
                    existingSchemaNames,
                    _paths,
                    _serviceUsers,
                    _insertTestData);
            }

            var orderedStepGroups = dependencyGraph.GetTopologicalOrder();

            foreach (var stepGroup in orderedStepGroups)
            {
                stepGroup.Execute(connection, transaction);
            }
        }