Exemplo n.º 1
0
 public FindMigrationVersions()
 {
     Options = new MigrationScriptOptions();
 }
        public MigrationVersion Create(TextReader reader, string filename, MigrationScriptOptions options, string defaultSchema = "default")
        {
            options.Validate();

            Match match = options.VersionFilenamePattern.Match(Path.GetFileName(filename));

            if (!match.Success)
            {
                throw new ArgumentException("Filename does not match migration version pattern");
            }

            string version = GetVersion(match);
            string schema = GetSchema(match, defaultSchema);

            MigrationVersionScriptMetadata metadata;

            string scriptContents = ParseScriptContents(reader, out metadata);

            string checksum = GenerateChecksum(scriptContents);

            long numericVersion = (options.VersionStrategy.SupportsNumericVersion)
                ? options.VersionStrategy.GetNumericVersion(version)
                : 0L;

            return new MigrationVersion(schema, version, numericVersion, metadata.Description, metadata.SkipCondition, scriptContents, checksum);
        }
Exemplo n.º 3
0
 public GenerateMigrationScript()
 {
     MigrationScriptOptions = new MigrationScriptOptions();
     ScriptGenerationOptions = new ScriptGenerationOptions();
 }
 public bool CanCreate(string filename, MigrationScriptOptions options)
 {
     return options.VersionFilenamePattern.IsMatch(Path.GetFileName(filename));
 }