abp icon indicating copy to clipboard operation
abp copied to clipboard

abp cli create-migration-and-run-migrator comand error.

Open jhq1911 opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

D:\abptest\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\Services\InitialMigrationCreator.cs

the old code :

        var tenantDbContextName = FindTenantDbContextName(targetProjectFolder);
        var dbContextName = tenantDbContextName != null ?
            FindDbContextName(targetProjectFolder)
            : null;

        var migrationOutput = AddMigrationAndGetOutput(targetProjectFolder, dbContextName, "Migrations");
        var tenantMigrationOutput = tenantDbContextName != null ?
            AddMigrationAndGetOutput(targetProjectFolder, tenantDbContextName, "TenantMigrations")
            : null;

when can't found tenantDbContextName will all failed. in fact , there are offten haven't tenantDbContextName . so i think the right logic code like this :

        var tenantDbContextName = FindTenantDbContextName(targetProjectFolder);
        var dbContextName = tenantDbContextName != null ?
            null
            : FindDbContextName(targetProjectFolder);
         
        var migrationOutput = dbContextName != null ?
            AddMigrationAndGetOutput(targetProjectFolder, dbContextName, "Migrations")
            : null;
        var tenantMigrationOutput = tenantDbContextName != null ?
            AddMigrationAndGetOutput(targetProjectFolder, tenantDbContextName, "TenantMigrations")
            : null;

Reproduction Steps

No response

Expected behavior

No response

Actual behavior

No response

Regression?

No response

Known Workarounds

No response

Version

8.2.2

User Interface

Common (Default)

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

Windows (Default)

Other information

No response

jhq1911 avatar Sep 05 '24 02:09 jhq1911