Merge pull request #7247 from abpframework/auto-merge/rel-4-2/80

Merge branch dev with rel-4.2
pull/7262/head
liangshiwei 5 years ago committed by GitHub
commit ddfea8540e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -54,10 +54,12 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
if (_companyName != null) if (_companyName != null)
{ {
RenameHelper.RenameAll(_entries, _companyNamePlaceHolder, _companyName); RenameHelper.RenameAll(_entries, _companyNamePlaceHolder, _companyName);
RenameHelper.RenameAll(_entries, _companyNamePlaceHolder.ToCamelCase(), _companyName.ToCamelCase());
} }
else else
{ {
RenameHelper.RenameAll(_entries, _companyNamePlaceHolder + "." + _projectNamePlaceHolder, _projectNamePlaceHolder); RenameHelper.RenameAll(_entries, _companyNamePlaceHolder + "." + _projectNamePlaceHolder, _projectNamePlaceHolder);
RenameHelper.RenameAll(_entries, _companyNamePlaceHolder.ToCamelCase() + "." + _projectNamePlaceHolder.ToCamelCase(), _projectNamePlaceHolder.ToCamelCase());
} }
} }

@ -41,9 +41,9 @@ namespace MyCompanyName.MyProjectName.Data
{ {
try try
{ {
if (!await MigrationsFolderExists()) if (DbMigrationsProjectExists() && !MigrationsFolderExists())
{ {
await AddInitialMigration(); AddInitialMigration();
return; return;
} }
} }
@ -108,14 +108,21 @@ namespace MyCompanyName.MyProjectName.Data
await _dataSeeder.SeedAsync(tenant?.Id); await _dataSeeder.SeedAsync(tenant?.Id);
} }
private async Task<bool> MigrationsFolderExists() private bool DbMigrationsProjectExists()
{
var dbMigrationsProjectFolder = GetDbMigrationsProjectFolderPath();
return dbMigrationsProjectFolder != null;
}
private bool MigrationsFolderExists()
{ {
var dbMigrationsProjectFolder = GetDbMigrationsProjectFolderPath(); var dbMigrationsProjectFolder = GetDbMigrationsProjectFolderPath();
return Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "migrations")); return Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "migrations"));
} }
private async Task AddInitialMigration() private void AddInitialMigration()
{ {
Logger.LogInformation("Creating initial migration..."); Logger.LogInformation("Creating initial migration...");
@ -147,7 +154,7 @@ namespace MyCompanyName.MyProjectName.Data
} }
} }
private static string GetDbMigrationsProjectFolderPath() private string GetDbMigrationsProjectFolderPath()
{ {
var slnDirectoryPath = GetSolutionDirectoryPath(); var slnDirectoryPath = GetSolutionDirectoryPath();
@ -162,7 +169,7 @@ namespace MyCompanyName.MyProjectName.Data
.FirstOrDefault(d => d.EndsWith(".DbMigrations")); .FirstOrDefault(d => d.EndsWith(".DbMigrations"));
} }
private static string GetSolutionDirectoryPath() private string GetSolutionDirectoryPath()
{ {
var currentDirectory = new DirectoryInfo(Directory.GetCurrentDirectory()); var currentDirectory = new DirectoryInfo(Directory.GetCurrentDirectory());

Loading…
Cancel
Save