Closed Enissay closed 1 year ago
Did you run MyProject.DbMigrator
project to initialize the data?
Oh, I thought the dotnet ef migrations add
was supposed to take care of it...
Anyhow, I did try many combinations in vain: raw dotnet run
as suggested in documentation but it complained that the migrations were not found, they were actually in the src/MyProject.EntityFrameworkCore
.
I then added with many combinations of parameter --startup-project
and --project
but it all failed with different errors...
As a side note, the first error references a path like D:\ci\Jenkins\workspace\abp-framework-release\abp\...
which does not even exist on my linux distrbution. I wonder if that is causing issues ?
## Try 1
~/dev/MyProject - 02:04:07 ❯ cd src/MyProject.DbMigrator/
~/dev/MyProject/src/MyProject.DbMigrator - 02:04:10 ❯ dotnet run
[02:04:17 INF] Creating initial migration...
~/dev/MyProject/src/MyProject.DbMigrator - 02:04:17 ❯ [02:04:18 INF] ABP CLI 7.0.3
[02:04:18 INF] Creating initial migrations...
[02:04:18 ERR] Creating initial migrations process is failed! Details:
No project was found. Change the current working directory or use the --project option.
[02:04:18 ERR] Migrations failed! A migration command didn't run successfully.
[02:04:18 ERR] Migrations failed! A migration command didn't run successfully.
System.Exception: Migrations failed! A migration command didn't run successfully.
at Volo.Abp.Cli.Commands.CreateMigrationAndRunMigratorCommand.ExecuteAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\CreateMigrationAndRunMigratorCommand.cs:line 68
at Volo.Abp.Cli.CliService.RunInternalAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 168
at Volo.Abp.Cli.CliService.RunAsync(String[] args) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 76
## Try 2 with params
~/dev/MyProject/src/MyProject.DbMigrator - 02:04:22 ❯ cd ../..
~/dev/MyProject - 02:04:28 ❯ dotnet run \
--startup-project src/MyProject.EntityFrameworkCore/MyProject.EntityFrameworkCore.csproj \
--project src/MyProject.DbMigrator/MyProject.DbMigrator.csproj \
--context MyProject.EntityFrameworkCore.MyProjectDbContext \
--configuration Debug \
-- --environment Development
[02:04:37 INF] Started database migrations...
[02:04:37 INF] Migrating schema for host database...
Unhandled exception. System.ArgumentException: Host can't be null
at Npgsql.NpgsqlConnectionStringBuilder.PostProcessAndValidate()
at Npgsql.NpgsqlConnection.SetupDataSource()
at Npgsql.NpgsqlConnection.set_ConnectionString(String value)
at Npgsql.NpgsqlConnection..ctor(String connectionString)
at Npgsql.NpgsqlConnection.CloneWith(String connectionString)
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlRelationalConnection.CloneWith(String connectionString)
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlDatabaseCreator.Exists(Boolean async, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.ExistsAsync(CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.MigrateAsync(String targetMigration, CancellationToken cancellationToken)
at MyProject.EntityFrameworkCore.EntityFrameworkCoreMyProjectDbSchemaMigrator.MigrateAsync() in /home/enissay/dev/MyProject/src/MyProject.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreMyProjectDbSchemaMigrator.cs:line 29
at MyProject.Data.MyProjectDbMigrationService.MigrateDatabaseSchemaAsync(Tenant tenant) in /home/enissay/dev/MyProject/src/MyProject.Domain/Data/MyProjectDbMigrationService.cs:line 95
at MyProject.Data.MyProjectDbMigrationService.MigrateAsync() in /home/enissay/dev/MyProject/src/MyProject.Domain/Data/MyProjectDbMigrationService.cs:line 52
at MyProject.DbMigrator.DbMigratorHostedService.StartAsync(CancellationToken cancellationToken) in /home/enissay/dev/MyProject/src/MyProject.DbMigrator/DbMigratorHostedService.cs:line 36
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at MyProject.DbMigrator.Program.Main(String[] args) in /home/enissay/dev/MyProject/src/MyProject.DbMigrator/Program.cs:line 60
at MyProject.DbMigrator.Program.<Main>(String[] args)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Documentation
Please check the official documentation before asking questions: https://docs.abp.io => Done
GitHub Issues
Project created using:
Then, I update the
ConnectionStrings
AND the default passwordClientSecret
to use a longer one. TheConnectionStrings
also has the extraSearchPath=dev
since I am using a separate schema for different environment. Sample from DbMigrator project:I have also changed the DB prefixes and schema as follows in 4 locations:
Next I do generate the migrations and apply them. It all goes well with no errors:
After launching the AuthServer, I was unable to connect as admin using the new psw
KX8MuY5N5rJvhOD7XZu3xUz4LcQmvf*
. I also noticed the tableUsers
is completely empty.I was also unable to connect into swagger as I get this:
Any advice what I am missing ?