Example #1
0
        public void ListMigrations()
        {
            var currentVersionInfo = this.VersionLoader.VersionInfo;
            var currentVersion     = currentVersionInfo.Latest();

            _announcer.Heading("Migrations");

            foreach (var migration in MigrationLoader.LoadMigrations())
            {
                var migrationName = migration.Value.GetName();
                var status        = GetStatus(migration, currentVersion);
                var statusString  = string.Join(", ", GetStatusStrings(status));
                var message       = $"{migrationName}{(string.IsNullOrEmpty(statusString) ? string.Empty : $" ({statusString})")}";

                var isCurrent  = (status & MigrationStatus.AppliedMask) == MigrationStatus.Current;
                var isBreaking = (status & MigrationStatus.Breaking) == MigrationStatus.Breaking;
                if (isCurrent || isBreaking)
                {
                    _announcer.Emphasize(message);
                }
                else
                {
                    _announcer.Say(message);
                }
            }
        public void ListMigrations()
        {
            IVersionInfo currentVersionInfo = this.VersionLoader.VersionInfo;
            long         currentVersion     = currentVersionInfo.Latest();

            _announcer.Heading("Migrations");

            foreach (KeyValuePair <long, IMigrationInfo> migration in MigrationLoader.LoadMigrations())
            {
                string migrationName = migration.Value.GetName();
                bool   isCurrent     = migration.Key == currentVersion;
                string message       = string.Format("{0}{1}",
                                                     migrationName,
                                                     isCurrent ? " (current)" : string.Empty);

                if (isCurrent)
                {
                    _announcer.Emphasize(message);
                }
                else
                {
                    _announcer.Say(message);
                }
            }
        }
Example #3
0
 /// <inheritdoc />
 protected override void WriteEmphasize(string message)
 {
     _announcer.Emphasize(message);
 }