Skip to content

Commit

Permalink
Merge pull request #100 from rdagumampan/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
rdagumampan authored May 27, 2020
2 parents d2364d1 + 50167ba commit 9a36e14
Show file tree
Hide file tree
Showing 15 changed files with 215 additions and 194 deletions.
40 changes: 22 additions & 18 deletions yuniql-aspnetcore/YuniqApplicationBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ YuniqlConfiguration configuration
migrationService.Run(
configuration.WorkspacePath,
configuration.TargetVersion,
configuration.AutoCreateDatabase,
configuration.Tokens,
configuration.VerifyOnly,
configuration.BulkSeparator,
configuration.CommandTimeout,
configuration.BatchSize,
configuration.ApplyByTool,
configuration.ApplyByToolVersion,
configuration.Environment);
autoCreateDatabase: configuration.AutoCreateDatabase,
tokens: configuration.Tokens,
verifyOnly: configuration.VerifyOnly,
bulkSeparator: configuration.BulkSeparator,
metaSchemaName: configuration.MetaSchemaName,
metaTableName: configuration.MetaTableName,
commandTimeout: configuration.CommandTimeout,
bulkBatchSize: configuration.BulkBatchSize,
appliedByTool: configuration.ApplyByTool,
appliedByToolVersion: configuration.ApplyByToolVersion,
environmentCode: configuration.Environment);

return builder;
}
Expand Down Expand Up @@ -76,15 +78,17 @@ YuniqlConfiguration configuration
migrationService.Run(
configuration.WorkspacePath,
configuration.TargetVersion,
configuration.AutoCreateDatabase,
configuration.Tokens,
configuration.VerifyOnly,
configuration.BulkSeparator,
configuration.BatchSize,
configuration.CommandTimeout,
configuration.ApplyByTool,
configuration.ApplyByToolVersion,
configuration.Environment);
autoCreateDatabase: configuration.AutoCreateDatabase,
tokens: configuration.Tokens,
verifyOnly: configuration.VerifyOnly,
bulkSeparator: configuration.BulkSeparator,
metaSchemaName: configuration.MetaSchemaName,
metaTableName: configuration.MetaTableName,
commandTimeout: configuration.CommandTimeout,
bulkBatchSize: configuration.BulkBatchSize,
appliedByTool: configuration.ApplyByTool,
appliedByToolVersion: configuration.ApplyByToolVersion,
environmentCode: configuration.Environment);

return builder;
}
Expand Down
2 changes: 1 addition & 1 deletion yuniql-aspnetcore/Yuniql.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Yuniql.Core" Version="0.355.0" />
<PackageReference Include="Yuniql.Core" Version="0.451.0" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 11 additions & 1 deletion yuniql-aspnetcore/YuniqlConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class YuniqlConfiguration
/// The size of each batch when performing bulk load. Default is 100 rows.
/// This may not be used in non-sqlserver platforms.
/// </summary>
public int BatchSize { get; set; } = 100;
public int BulkBatchSize { get; set; } = 0;

/// <summary>
/// The time it taks to wait for one commend to execute before it expires and throws error.
Expand Down Expand Up @@ -82,5 +82,15 @@ public class YuniqlConfiguration
/// See https://github.com/rdagumampan/yuniql/wiki/environment-aware-scripts
/// </summary>
public string Environment { get; set; } = null;

/// <summary>
/// Schema name for schema versions table.
/// </summary>
public string MetaSchemaName { get; set; } = null;

/// <summary>
/// Table name for schema versions table.
/// </summary>
public string MetaTableName { get; set; } = null;
}
}
40 changes: 22 additions & 18 deletions yuniql-aspnetcore/YuniqlHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ YuniqlConfiguration configuration
migrationService.Run(
configuration.WorkspacePath,
configuration.TargetVersion,
configuration.AutoCreateDatabase,
configuration.Tokens,
configuration.VerifyOnly,
configuration.BulkSeparator,
configuration.BatchSize,
configuration.CommandTimeout,
configuration.ApplyByTool,
configuration.ApplyByToolVersion,
configuration.Environment);
autoCreateDatabase: configuration.AutoCreateDatabase,
tokens: configuration.Tokens,
verifyOnly: configuration.VerifyOnly,
bulkSeparator: configuration.BulkSeparator,
metaSchemaName: configuration.MetaSchemaName,
metaTableName: configuration.MetaTableName,
commandTimeout: configuration.CommandTimeout,
bulkBatchSize: configuration.BulkBatchSize,
appliedByTool: configuration.ApplyByTool,
appliedByToolVersion: configuration.ApplyByToolVersion,
environmentCode: configuration.Environment);

return builder;
}
Expand Down Expand Up @@ -77,15 +79,17 @@ YuniqlConfiguration configuration
migrationService.Run(
configuration.WorkspacePath,
configuration.TargetVersion,
configuration.AutoCreateDatabase,
configuration.Tokens,
configuration.VerifyOnly,
configuration.BulkSeparator,
configuration.BatchSize,
configuration.CommandTimeout,
configuration.ApplyByTool,
configuration.ApplyByToolVersion,
configuration.Environment);
autoCreateDatabase: configuration.AutoCreateDatabase,
tokens: configuration.Tokens,
verifyOnly: configuration.VerifyOnly,
bulkSeparator: configuration.BulkSeparator,
metaSchemaName: configuration.MetaSchemaName,
metaTableName: configuration.MetaTableName,
commandTimeout: configuration.CommandTimeout,
bulkBatchSize: configuration.BulkBatchSize,
appliedByTool: configuration.ApplyByTool,
appliedByToolVersion: configuration.ApplyByToolVersion,
environmentCode: configuration.Environment);

return builder;
}
Expand Down
40 changes: 22 additions & 18 deletions yuniql-aspnetcore/YuniqlWebHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ YuniqlConfiguration configuration
migrationService.Run(
configuration.WorkspacePath,
configuration.TargetVersion,
configuration.AutoCreateDatabase,
configuration.Tokens,
configuration.VerifyOnly,
configuration.BulkSeparator,
configuration.BatchSize,
configuration.CommandTimeout,
configuration.ApplyByTool,
configuration.ApplyByToolVersion,
configuration.Environment);
autoCreateDatabase: configuration.AutoCreateDatabase,
tokens: configuration.Tokens,
verifyOnly: configuration.VerifyOnly,
bulkSeparator: configuration.BulkSeparator,
metaSchemaName: configuration.MetaSchemaName,
metaTableName: configuration.MetaTableName,
commandTimeout: configuration.CommandTimeout,
bulkBatchSize: configuration.BulkBatchSize,
appliedByTool: configuration.ApplyByTool,
appliedByToolVersion: configuration.ApplyByToolVersion,
environmentCode: configuration.Environment);

return builder;
}
Expand Down Expand Up @@ -76,15 +78,17 @@ YuniqlConfiguration configuration
migrationService.Run(
configuration.WorkspacePath,
configuration.TargetVersion,
configuration.AutoCreateDatabase,
configuration.Tokens,
configuration.VerifyOnly,
configuration.BulkSeparator,
configuration.BatchSize,
configuration.CommandTimeout,
configuration.ApplyByTool,
configuration.ApplyByToolVersion,
configuration.Environment);
autoCreateDatabase: configuration.AutoCreateDatabase,
tokens: configuration.Tokens,
verifyOnly: configuration.VerifyOnly,
bulkSeparator: configuration.BulkSeparator,
metaSchemaName: configuration.MetaSchemaName,
metaTableName: configuration.MetaTableName,
commandTimeout: configuration.CommandTimeout,
bulkBatchSize: configuration.BulkBatchSize,
appliedByTool: configuration.ApplyByTool,
appliedByToolVersion: configuration.ApplyByToolVersion,
environmentCode: configuration.Environment);

return builder;
}
Expand Down
13 changes: 6 additions & 7 deletions yuniql-cli/BaseRunPlatformOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace Yuniql.CLI
{

public class BaseRunPlatformOption : BasePlatformOption
{
//yuniql <command> -t v1.05 | --target-version v1.05
Expand Down Expand Up @@ -31,12 +30,12 @@ public class BaseRunPlatformOption : BasePlatformOption
[Option("environment", Required = false, HelpText = "Environment code for environment-aware scripts.")]
public string Environment { get; set; }

//yuniql <command> --schema "yuniql"
[Option("schema", Required = false, HelpText = "Schema name for schema versions table.")]
public string Schema { get; set; }
//yuniql <command> --meta-schema "yuniql"
[Option("meta-schema", Required = false, HelpText = "Schema name for schema versions table.")]
public string MetaSchema { get; set; }

//yuniql <command> --table "__yuniqlschemaversions"
[Option("table", Required = false, HelpText = "Table name for schema versions table.")]
public string Table { get; set; }
//yuniql <command> --meta-table "__yuniqlschemaversions"
[Option("meta-table", Required = false, HelpText = "Table name for schema versions table.")]
public string MetaTable { get; set; }
}
}
10 changes: 5 additions & 5 deletions yuniql-cli/CommandLineService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ public int RunMigration(RunOption opts)
tokens: tokens,
verifyOnly: false,
bulkSeparator: opts.BulkSeparator,
schemaName: opts.Schema,
tableName: opts.Table,
metaSchemaName: opts.MetaSchema,
metaTableName: opts.MetaTable,
commandTimeout: opts.CommandTimeout,
bulkBatchSize: opts.BulkBatchSize,
appliedByTool: toolName,
Expand Down Expand Up @@ -204,8 +204,8 @@ public int RunVerify(VerifyOption opts)
tokens: tokens,
verifyOnly: true,
bulkSeparator: opts.BulkSeparator,
schemaName: opts.Schema,
tableName: opts.Table,
metaSchemaName: opts.MetaSchema,
metaTableName: opts.MetaTable,
commandTimeout: opts.CommandTimeout,
bulkBatchSize: opts.BulkBatchSize,
appliedByTool: toolName,
Expand Down Expand Up @@ -247,7 +247,7 @@ public int RunInfoOption(InfoOption opts)
//get all exsiting db versions
var migrationService = _migrationServiceFactory.Create(opts.Platform);
migrationService.Initialize(opts.ConnectionString, opts.CommandTimeout);
var versions = migrationService.GetAllVersions(opts.Schema, opts.Table);
var versions = migrationService.GetAllVersions(opts.MetaSchema, opts.MetaTable);

var results = new StringBuilder();
results.AppendLine($"Version\t\tCreated\t\t\t\tCreatedBy");
Expand Down
10 changes: 5 additions & 5 deletions yuniql-cli/InfoOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ namespace Yuniql.CLI
[Verb("info", HelpText = "Shows all the migrations applied to target database.")]
public class InfoOption : BasePlatformOption
{
//yuniql <command> --schema "yuniql"
[Option("schema", Required = false, HelpText = "Schema name for schema versions table.")]
public string Schema { get; set; }
//yuniql <command> --meta-schema "yuniql"
[Option("meta-schema", Required = false, HelpText = "Schema name for schema versions table.")]
public string MetaSchema { get; set; }

//yuniql <command> --table "__yuniqlschemaversions"
[Option("table", Required = false, HelpText = "Table name for schema versions table.")]
public string Table { get; set; }
[Option("meta-table", Required = false, HelpText = "Table name for schema versions table.")]
public string MetaTable { get; set; }
}
}
Loading

0 comments on commit 9a36e14

Please sign in to comment.