示例#1
0
 public static void MoveGameItem(ref MigrationFile file)
 {
     file.Status = MigrationStatus.Migrating;
     try
     {
         FMove(file.source, file.destination, true);
         file.Status = MigrationStatus.Successful;
     }
     catch (Exception e)
     {
         file.Status = MigrationStatus.Failed;
         Console.WriteLine(e.Message);
     }
 }
示例#2
0
        public void BadMigrationFileNameShouldThrowFriendlyMessage()
        {
            Action testSubject = () => MigrationFile.FileNameVersion("3asfasdf.migration.sql");

            testSubject.Should().Throw <TerminateProgramWithMessageException>()
            .WithMessage(
                @"Invalid migration file name found.

I don't know how to extract the version number from the file name
'3asfasdf.migration.sql'.

Migration files are required to be named like 'X_name.migration.sql', where
X is the version number and name can be anything you want.")
            .And.ErrorLevel.Should().Be(1);
        }
示例#3
0
        public IEnumerable <MigrationFile> Backup()
        {
            List <MigrationFile> migrationFiles = new List <MigrationFile>();

            foreach (string file in files)
            {
                string filePath = PathHelper.Combine(path, file.Trim());
                string contents = File.ReadAllText(filePath);

                MigrationFile migrationFile = new MigrationFile
                {
                    FilePath = filePath,
                    Contents = contents
                };

                string message = string.Format(CultureManager.GetCurrent(), Labels.BackingUpForMigration, filePath);
                this.OnProgress(new ProgressInfo(this.Description, message));

                migrationFiles.Add(migrationFile);
            }

            return(migrationFiles);
        }
示例#4
0
 public void ShouldKnowHowToGetVersionNumberFromFileName()
 {
     MigrationFile.FileNameVersion("3_asfasdf.migration.sql").Should().Be(3);
 }
示例#5
0
 public MigrationSpecification(MigrationFile migrationFile)
     : this(
         migrationFile.Version, migrationFile.Name, migrationFile.Apply, migrationFile.Unapply, migrationFile.InsertTestData,
         migrationFile.DeleteTestData)
 {
 }