Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EfCore执行 add-migration ,update-database时出现以下错误,postgres是在哪儿设置的? #10

Open
YoChen opened this issue Apr 29, 2024 · 3 comments

Comments

@YoChen
Copy link

YoChen commented Apr 29, 2024

Kdbndp.KingbaseException (0x80004005): 3D000: database "postgres" does not exist at Kdbndp.KdbndpConnector.<>c__DisplayClass166_0.<<ReadMessage>g__ReadMessageLong|0>d.MoveNext() --- End of stack trace from previous location --- at Kdbndp.KdbndpConnector.<>c__DisplayClass166_0.<<ReadMessage>g__ReadMessageLong|0>d.MoveNext() --- End of stack trace from previous location --- at Kdbndp.KdbndpConnector.Open(KdbndpTimeout timeout, Boolean async, CancellationToken cancellationToken) at Kdbndp.KdbndpConnection.<>c__DisplayClass34_0.<<Open>g__OpenLong|0>d.MoveNext() --- End of stack trace from previous location --- at Kdbndp.KdbndpConnection.Open() at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnection(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternal(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable1 migrationCommands, IRelationalConnection connection)
at Kdbndp.EntityFrameworkCore.KingbaseES.Storage.Internal.KdbndpDatabaseCreator.Create()
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String connectionString, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String connectionString, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
3D000: database "postgres" does not exist`

@YoChen
Copy link
Author

YoChen commented Apr 29, 2024

临时解决办法:

新建一个postgres空数据库,然后再执行迁移就可以了。

@YoChen
Copy link
Author

YoChen commented Apr 29, 2024

Configure<AbpDbContextOptions>(options => { /* The main point to change your DBMS. * See also DataDictionaryMigrationsDbContextFactory for EF Core tooling. */ options.UseKdbndp(b => { b.MigrationsHistoryTable("__DataDictionary_Migrations"); b.UseAdminDatabase("kingbase"); }); });

b.UseAdminDatabase("kingbase"); 或是在配置数据库上下文时增加这句?

@wangpengxpy
Copy link
Collaborator

wangpengxpy commented May 20, 2024

没明白你的问题,看异常信息是连接的数据库postgres不存在

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants