C# Class DatabaseMigraine.Managers.MigrationManager

Inheritance: DbScriptFolderManager
Exibir arquivo Open project: 7digital/DatabaseMigraine Class Usage Examples

Public Methods

Method Description
GenerateMigrations ( DirectoryInfo dbScriptsPath, string dbname, Server server, DirectoryInfo outPath ) : int
GenerateMigrationsContentsToDisk ( IEnumerable scripts, DirectoryInfo outPath, string dbname ) : int
GetMigrationId ( string scriptFileNameWithoutExtension ) : int
GetMigrationsRunInDb ( DirectoryInfo dbScriptsPath, Server dbServer, string dbname ) : IEnumerable
GetNonRetiredMigrationsRunInDb ( DirectoryInfo dbScriptsPath, Server dbServer, string dbname ) : IEnumerable
GetSqlSriptsIn ( string dbScriptsPath ) : IEnumerable
RunScripts ( Server disposableDbServer, string dbScriptsPath, string dbname, string originalDbName, IEnumerable scriptFileNameWhiteList ) : int

Protected Methods

Method Description
CheckContentViolationRules ( string>.Dictionary elementNameToScriptContents, string originalDbName ) : void
RetrieveContentsWhileCheckConventions ( string originalDbName, IEnumerable scripts ) : string>.IDictionary
RunScript ( string>.KeyValuePair script, string dbname ) : void

Private Methods

Method Description
CheckForRiskyBatchStatementGO ( string>.IDictionary scriptsWithContents ) : void
CheckIfDatabaseChangeLogTableExists ( Database database ) : void
EscapeSql ( string content ) : string
FileNameToTransactionName ( string scriptFileNameWithoutExtension ) : string
GenerateHash ( string scriptContents ) : string
GenerateMigration ( string scriptFileNameWithoutExtension, string scriptContents ) : GeneratedMigration
GenerateMigrationFor ( SqlExecutor executor, string scriptFileNameWithoutExtension, string scriptContents, string dbname ) : GeneratedMigration
GetInsertStatementForMigration ( FileInfo script ) : string
GetInsertStatementForMigration ( int migrationId, string scriptFileNameWithoutExtension, string hash ) : string
MigrationAlreadyRun ( SqlExecutor executor, string hash, string dbname ) : bool

Method Details

CheckContentViolationRules() protected method

protected CheckContentViolationRules ( string>.Dictionary elementNameToScriptContents, string originalDbName ) : void
elementNameToScriptContents string>.Dictionary
originalDbName string
return void

GenerateMigrations() public method

public GenerateMigrations ( DirectoryInfo dbScriptsPath, string dbname, Server server, DirectoryInfo outPath ) : int
dbScriptsPath System.IO.DirectoryInfo
dbname string
server Server
outPath System.IO.DirectoryInfo
return int

GenerateMigrationsContentsToDisk() public method

public GenerateMigrationsContentsToDisk ( IEnumerable scripts, DirectoryInfo outPath, string dbname ) : int
scripts IEnumerable
outPath System.IO.DirectoryInfo
dbname string
return int

GetMigrationId() public static method

public static GetMigrationId ( string scriptFileNameWithoutExtension ) : int
scriptFileNameWithoutExtension string
return int

GetMigrationsRunInDb() public method

public GetMigrationsRunInDb ( DirectoryInfo dbScriptsPath, Server dbServer, string dbname ) : IEnumerable
dbScriptsPath System.IO.DirectoryInfo
dbServer Server
dbname string
return IEnumerable

GetNonRetiredMigrationsRunInDb() public method

public GetNonRetiredMigrationsRunInDb ( DirectoryInfo dbScriptsPath, Server dbServer, string dbname ) : IEnumerable
dbScriptsPath System.IO.DirectoryInfo
dbServer Server
dbname string
return IEnumerable

GetSqlSriptsIn() public method

public GetSqlSriptsIn ( string dbScriptsPath ) : IEnumerable
dbScriptsPath string
return IEnumerable

RetrieveContentsWhileCheckConventions() protected method

protected RetrieveContentsWhileCheckConventions ( string originalDbName, IEnumerable scripts ) : string>.IDictionary
originalDbName string
scripts IEnumerable
return string>.IDictionary

RunScript() protected method

protected RunScript ( string>.KeyValuePair script, string dbname ) : void
script string>.KeyValuePair
dbname string
return void

RunScripts() public method

public RunScripts ( Server disposableDbServer, string dbScriptsPath, string dbname, string originalDbName, IEnumerable scriptFileNameWhiteList ) : int
disposableDbServer Server
dbScriptsPath string
dbname string
originalDbName string
scriptFileNameWhiteList IEnumerable
return int