Пример #1
0
        public void LoadVersionInfo()
        {
            if ( Processor.Options.PreviewOnly )
            {
                if ( !AlreadyCreatedVersionTable )
                {
                    Runner.Up( VersionMigration );
                    VersionInfo = new VersionInfo();
                }
                else
                    VersionInfo = new VersionInfo();

                return;
            }

            if ( !AlreadyCreatedVersionTable )
            {
                Runner.Up( VersionMigration );
                _versionInfo = new VersionInfo();
                return;
            }

            var dataSet = Processor.ReadTableData( VersionTableMetaData.TableName );
            _versionInfo = new VersionInfo();

            foreach ( DataRow row in dataSet.Tables[ 0 ].Rows )
            {
                _versionInfo.AddAppliedMigration( long.Parse( row[ 0 ].ToString() ) );
            }
        }
Пример #2
0
        public void LoadVersionInfo()
        {
            if (!AlreadyCreatedVersionSchema)
                Runner.Up(VersionSchemaMigration);

            bool isNewTable = false;
            if ( !AlreadyCreatedVersionTable )
            {
                Runner.Up( VersionMigration );
                isNewTable = true;
            }

            if (Processor.Options.StoreExtendedData && !AlreadyCreatedExtendedVersionTable)
            {
                Runner.Up(ExtendedVersionMigration);
            }
            if (isNewTable)
            {
                _versionInfo = new VersionInfo();
                return;
            }
            var dataSet = Processor.ReadTableData(VersionTableMetaData.SchemaName, VersionTableMetaData.TableName );
            _versionInfo = new VersionInfo();

            foreach ( DataRow row in dataSet.Tables[ 0 ].Rows )
            {
                var migrationVersion = long.Parse(row[0].ToString());
                _versionInfo.AddAppliedMigration( migrationVersion );
                if ((Processor.Options.StoreExtendedData) && (VersionTableMetaData is IExtendedVersionTableMetadata))
                {
                    var extendedTableMetadata = (IExtendedVersionTableMetadata) VersionTableMetaData;
                    _versionInfo.AddAppliedMigrationInfo(
                        migrationVersion,
                        row[extendedTableMetadata.DescriptionColumnName].ToString(),
                        row[extendedTableMetadata.DateAppliedColumnName] is DateTime ? (DateTime) row[extendedTableMetadata.DateAppliedColumnName] : new DateTime(),
                        row[extendedTableMetadata.ElapsedTimeColumnName] is double ? (double) row[extendedTableMetadata.ElapsedTimeColumnName] : 0d);
                }
            }
        }
        private void LoadVersionInfo()
        {
            if (_migrationProcessor.Options.PreviewOnly)
            {
                if (!_alreadyCreatedVersionTable)
                {
                    new MigrationRunner(_migrationConventions, _migrationProcessor, _announcer, new StopWatch())
                        .Up(_versionMigration);
                    _versionInfo = new VersionInfo();
                    _alreadyCreatedVersionTable = true;
                }
                else
                    _versionInfo = new VersionInfo();
                return;
            }

            if (!_migrationProcessor.TableExists(_versionTableMetaData.TableName))
            {
                var runner = new MigrationRunner(_migrationConventions, _migrationProcessor, _announcer, new StopWatch());
                runner.Up(_versionMigration);
                _versionInfo = new VersionInfo();
                return;
            }

            var dataSet = _migrationProcessor.ReadTableData(_versionTableMetaData.TableName);
            _versionInfo = new VersionInfo();

            foreach (DataRow row in dataSet.Tables[0].Rows)
            {
                _versionInfo.AddAppliedMigration(long.Parse(row[0].ToString()));
            }
        }
        private void loadVersionInfo()
        {
            if (!_migrationProcessor.TableExists(_versionTableMetaData.TableName))
            {
                var runner = new MigrationRunner(_migrationConventions, _migrationProcessor);
                runner.Up(_versionMigration);
            }

            var dataSet = _migrationProcessor.ReadTableData(_versionTableMetaData.TableName);
            _versionInfo = new VersionInfo();

            foreach (DataRow row in dataSet.Tables[0].Rows)
            {
                _versionInfo.AddAppliedMigration(long.Parse(row[0].ToString()));
            }
        }