Represents a script repository that stores build scripts in a Git repository.
The build script files in the distributed version repository must be organized with the same structure as required by FileSystemScriptRepository. The root location must contain subdirectories for each database schema, each named with the name of the schema. Within those directories should be a directory for each database object type: Function, Procedure, Type, View. Within those directories should be the build scripts, with file names ending with ".sql". The name of each file should be the same name as the database object it creates.
Inheritance: DvcsScriptRepositoryBase
 public Database Create(FileInfo pathToGit, IParser sqlParser)
 {
     var connectionStr = ConnectionString;
     Func<SqlConnection> connection = () => new SqlConnection(connectionStr);
     var repo = new GitScriptRepository(ScriptsPath, ServerName, DatabaseName, pathToGit, sqlParser);
     return new Database(ServerName, DatabaseName, connection, repo);
 }
        public void SetUp()
        {
            var gitExe = new Mock<IExternalProcess>();
            
            _parser = new FakeParser();
            _logger = new FakeLogger();

            _fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>());
            _directory = new MockDirectoryInfo(_fileSystem, @"C:\databasename");

            _service = new GitScriptRepository(_directory, "servername", databaseName, gitExe.Object, _fileSystem, _parser, _logger, true);
        }
Exemplo n.º 3
0
        private async Task Update(DatabaseSetting dbSetting, DvcsScriptRepositoryBase.RevisionIdentifierBase sourceChangeset)
        {
            ICollection<BuildItem> buildItems;
            using (var connection = new SqlConnection(dbSetting.ConnectionString))
            {
                await connection.OpenAsync();
                using (var transaction = connection.BeginTransaction())
                {
                    var fileSystem = new FileSystem();
                    var db = dbSetting.Create(connection, transaction);
                    var gitProcess = new ExternalProcess(pathToGit.FullName);
                    var dvcsScriptRepo = new GitScriptRepository(dbSetting.ScriptsPath, dbSetting.ServerName, dbSetting.DatabaseName, gitProcess, fileSystem, sqlParser, new ConsoleLogger(SeverityLevel.Warning), false);
                    dvcsScriptRepo.SourceChangeset = sourceChangeset;

                    buildItems = await db.GetChangedBuildItemsAsync(dvcsScriptRepo);
                    transaction.Commit();
                }
            }

            await DispatcherInvoke(() =>
            {
                ((MainWindowViewModel)DataContext).IsReady = true;
                ((MainWindowViewModel)DataContext).IsDone = false;
                ObservableCollection<BuildItemViewModel> itemsCollection = new ObservableCollection<BuildItemViewModel>
                    (buildItems.Select(x => new BuildItemViewModel(x, Dispatcher)));
                ((MainWindowViewModel)DataContext).Items = itemsCollection;
            });
        }