src/Curiosity.Migrations/MigrationProviders/ScriptMigrationsProvider.cs
/// <summary>
/// Creates script migration. Replace variables placeholders with real values
/// </summary>
/// <param name="dbVersion"></param>
/// <param name="scriptInfo"></param>
/// <param name="dbProvider"></param>
/// <param name="variables"></param>
/// <returns></returns>
Creates script migration. Replace variables placeholders with real values
Creates script migration . Replace variables placeholders with real values
private IMigration CreateScriptMigration(
            DbVersion dbVersion,
            ScriptInfo scriptInfo,
            IDbProvider dbProvider,
            IReadOnlyDictionary<string, string> variables)
        {
            var upScript = scriptInfo.UpScript;
            var downScript = scriptInfo.DownScript;
            foreach (var keyValuePair in variables)
            {
                upScript = upScript.Replace(keyValuePair.Key, keyValuePair.Value);
                downScript = downScript?.Replace(keyValuePair.Key, keyValuePair.Value);
            }
            return new ScriptMigration(
                dbProvider,
                dbVersion,
                upScript,
                downScript,
                scriptInfo.Comment);
        }
private IMigration CreateScriptMigration ( DbVersion dbVersion , ScriptInfo scriptInfo , IDbProvider dbProvider , IReadOnlyDictionary < string , string > variables ) { var upScript = scriptInfo . UpScript ; var downScript = scriptInfo . DownScript ; foreach ( var keyValuePair in variables ) { upScript = upScript . Replace ( keyValuePair . Key , keyValuePair . Value ) ; downScript = downScript ? . Replace ( keyValuePair . Key , keyValuePair . Value ) ; } return new ScriptMigration ( dbProvider , dbVersion , upScript , downScript , scriptInfo . Comment ) ; }
Creates script migration.
Creates script migration .
None
dbVersion
DbVersion
None
scriptInfo
ScriptInfo
None
dbProvider
IDbProvider
None
variables
IReadOnlyDictionary<string, string>
None