public virtual AppliedMigration StartMigration(Migration migration)
        {
            var appliedMigration = new AppliedMigration(migration);

            Task.WaitAll(GetMigrationsApplied().InsertOneAsync(appliedMigration));
            return(appliedMigration);
        }
Exemple #2
0
 public virtual void CompleteMigration(AppliedMigration appliedMigration)
 {
     appliedMigration.CompletedOn = DateTime.Now;
     GetMigrationsApplied().FindOneAndUpdate <AppliedMigration>(
         Builders <AppliedMigration> .Filter.Where(am => am.Version == appliedMigration.Version),
         Builders <AppliedMigration> .Update.Set(nameof(appliedMigration.CompletedOn), appliedMigration.CompletedOn));
 }
        public virtual AppliedMigration StartMigration(Migration migration)
        {
            var appliedMigration = new AppliedMigration(migration);

            GetMigrationsCollection().Insert(appliedMigration);
            return(appliedMigration);
        }
        /// <inheritdoc />
        public virtual void MarkVersion(MigrationVersion version)
        {
            var appliedMigration = AppliedMigration.MarkerOnly(version);

            GetAppliedMigrationsCollection()
            .InsertOne(appliedMigration);
        }
        public virtual AppliedMigration StartMigration(Migration migration)
        {
            var appliedMigration = new AppliedMigration(migration);

            ////GetMigrationsApplied().InsertOne(appliedMigration);
            return(appliedMigration);
        }
        public virtual Task MarkVersionAsync(MigrationVersion version,
                                             CancellationToken cancellationToken = default(CancellationToken))
        {
            var appliedMigration = AppliedMigration.MarkerOnly(version);

            return(GetMigrationsApplied().InsertOneAsync(appliedMigration,
                                                         null, cancellationToken));
        }
 public virtual Task CompleteMigrationAsync(AppliedMigration appliedMigration,
                                            CancellationToken cancellationToken = default(CancellationToken))
 {
     return(GetMigrationsApplied().UpdateOneAsync(
                x => x.Version == appliedMigration.Version,
                Builders <AppliedMigration> .Update.Set(x => x.CompletedOn, DateTime.UtcNow),
                null, cancellationToken));
 }
        public virtual async Task <AppliedMigration> StartMigrationAsync(Migration migration,
                                                                         CancellationToken cancellationToken = default(CancellationToken))
        {
            var appliedMigration = new AppliedMigration(migration);

            await GetMigrationsApplied().InsertOneAsync(
                appliedMigration, null, cancellationToken);

            return(appliedMigration);
        }
 public virtual void CompleteMigration(AppliedMigration appliedMigration)
 {
     appliedMigration.CompletedOn = DateTime.Now;
     Task.WaitAll(
         GetMigrationsApplied().UpdateOneAsync(
             m => m.Version == appliedMigration.Version,
             Builders <AppliedMigration> .Update.Set(x => x.CompletedOn, DateTime.Now)
             )
         );
 }
 public virtual AppliedMigration StartMigration(Migration migration) {
     var appliedMigration = new AppliedMigration(migration);
     long docCount = 0;
     if (migration is CollectionMigration) {
         var collection = ((CollectionMigration)migration).GetCollection();
         docCount = collection.Count();
     }
     appliedMigration.TotalCount = docCount;
     GetMigrationsCollection().Insert(appliedMigration);
     return appliedMigration;
 }
Exemple #11
0
        public virtual IEnumerable <Migration> GetMigrationsAfter(AppliedMigration currentVersion)
        {
            var migrations = GetAllMigrations();

            if (currentVersion != null)
            {
                migrations = migrations.Where(m => m.Version > currentVersion.Version);
            }

            return(migrations.OrderBy(m => m.Version));
        }
        public virtual AppliedMigration StartMigration(Migration migration)
        {
            var  appliedMigration = new AppliedMigration(migration);
            long docCount         = 0;

            if (migration is CollectionMigration)
            {
                var collection = ((CollectionMigration)migration).GetCollection();
                docCount = collection.Count();
            }
            appliedMigration.TotalCount = docCount;
            GetMigrationsCollection().Insert(appliedMigration);
            return(appliedMigration);
        }
 public virtual void CompleteMigration(AppliedMigration appliedMigration)
 {
     appliedMigration.CompletedOn = DateTime.Now;
     GetMigrationsApplied().Save(appliedMigration);
 }
        public virtual void MarkVersion(MigrationVersion version)
        {
            var appliedMigration = AppliedMigration.MarkerOnly(version);

            Task.WaitAll(GetMigrationsApplied().InsertOneAsync(appliedMigration));
        }
 public virtual void CompleteMigration(AppliedMigration appliedMigration) {
     GetMigrationsCollection().Update(Query.EQ("_id", new BsonString(appliedMigration.Version.ToString())), Update.Set("CompletedOn", new BsonDateTime(DateTime.Now)));
 }
 public virtual void CompleteMigration(AppliedMigration appliedMigration)
 {
     appliedMigration.CompletedOn = DateTime.Now;
     GetMigrationsApplied().ReplaceOne(x => x.Version == appliedMigration.Version, appliedMigration);
 }
 public virtual void CompleteMigration(AppliedMigration appliedMigration)
 {
     appliedMigration.CompletedOn = DateTime.Now;
     GetMigrationsApplied().InsertOne(appliedMigration);
 }
 public virtual AppliedMigration StartMigration(Migration migration) {
     var appliedMigration = new AppliedMigration(migration);
     GetMigrationsCollection().Insert(appliedMigration);
     return appliedMigration;
 }
 public virtual void CompleteMigration(AppliedMigration appliedMigration)
 {
     GetMigrationsCollection().Update(Query.EQ("_id", new BsonString(appliedMigration.Version.ToString())), Update.Set("CompletedOn", new BsonDateTime(DateTime.Now)));
 }
Exemple #20
0
        public virtual void MarkVersion(MigrationVersion version)
        {
            var appliedMigration = AppliedMigration.MarkerOnly(version);

            GetMigrationsApplied().Insert(appliedMigration);
        }
 public virtual void CompleteMigration(AppliedMigration appliedMigration)
 {
     appliedMigration.CompletedOn = DateTime.Now;
     GetMigrationsApplied().ReplaceOne(x => x.Version == appliedMigration.Version, appliedMigration);
 }