Ends in:
2 DAYS
2 HRS
5 MIN
0 SEC
Ends in:
2 D
2 H
5 M
0 S
Open Closed

How to add new tenant and database #2341


User avatar
0
vishalnikam created
  • ABP Framework version: v4.3.1
  • UI type: Angular
  • DB provider: EF Core / PostgreSQL
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

We already have one tenant with silo database approach. now, wanted to add new tenant as same. added one tenant and database string (empty database). clicked on apply migration link. it says database migration has been queued and will be applied soon. then nothing happen to database. where do we check the queued entry and status in db.

please guide on new tenant add process. also database migration is automatic process or manual ? when we have more then two tenant then new table migration will be applied to both tenant or what ? how specify apply for particular tenant ?


6 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Can you try to debug the backend project and check the <YourProjectName>TenantDatabaseMigrationHandler to see what is happening?

    Also, please share the logs.

  • User Avatar
    0
    vishalnikam created

    Hi,

    I don't see any TenantDatabaseMigrationHandler in source code and background job entry in AbpBackgroundJobs. also, please check attached logs. let me know if we can connect over Skype.

    2021-12-30 15:42:04.522 +05:30 [INF] Request starting HTTP/1.1 OPTIONS https://localhost:44359/api/saas/tenants/3a0117c6-98fa-f040-47e9-a37ff4a7bb46/apply-database-migrations - - 2021-12-30 15:42:04.522 +05:30 [INF] CORS policy execution successful. 2021-12-30 15:42:04.523 +05:30 [INF] Request finished HTTP/1.1 OPTIONS https://localhost:44359/api/saas/tenants/3a0117c6-98fa-f040-47e9-a37ff4a7bb46/apply-database-migrations - - - 204 - - 0.7421ms 2021-12-30 15:42:04.531 +05:30 [INF] Request starting HTTP/1.1 POST https://localhost:44359/api/saas/tenants/3a0117c6-98fa-f040-47e9-a37ff4a7bb46/apply-database-migrations - 0 2021-12-30 15:42:04.531 +05:30 [INF] CORS policy execution successful. 2021-12-30 15:42:04.534 +05:30 [INF] Start processing HTTP request POST "https://localhost:44350/connect/introspect" 2021-12-30 15:42:04.534 +05:30 [INF] Sending HTTP request POST "https://localhost:44350/connect/introspect" 2021-12-30 15:42:05.976 +05:30 [INF] Received HTTP response headers after 1441.6968ms - 200 2021-12-30 15:42:05.976 +05:30 [INF] End processing HTTP request after 1442.0202ms - 200 2021-12-30 15:42:05.976 +05:30 [DBG] AuthenticationScheme: introspection was successfully authenticated. 2021-12-30 15:42:05.978 +05:30 [INF] Executing endpoint 'Volo.Saas.Host.TenantController.ApplyDatabaseMigrationsAsync (Volo.Saas.Host.HttpApi)' 2021-12-30 15:42:05.981 +05:30 [INF] Route matched with {controller = "Tenant", area = "saas", action = "ApplyDatabaseMigrations", page = ""}. Executing controller action with signature System.Threading.Tasks.Task ApplyDatabaseMigrationsAsync(System.Guid) on controller Volo.Saas.Host.TenantController (Volo.Saas.Host.HttpApi). 2021-12-30 15:42:05.986 +05:30 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:5dc0ff50-a197-c0a3-bcbe-39f5d3e999ac,n:Saas.Tenants.ManageConnectionStrings 2021-12-30 15:42:05.989 +05:30 [DBG] Found in the cache: pn:U,pk:5dc0ff50-a197-c0a3-bcbe-39f5d3e999ac,n:Saas.Tenants.ManageConnectionStrings 2021-12-30 15:42:05.989 +05:30 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:Saas.Tenants.ManageConnectionStrings 2021-12-30 15:42:06.002 +05:30 [DBG] Found in the cache: pn:R,pk:admin,n:Saas.Tenants.ManageConnectionStrings 2021-12-30 15:42:06.003 +05:30 [DBG] PermissionStore.GetCacheItemAsync: pn:C,pk:Litmus_App,n:Saas.Tenants.ManageConnectionStrings 2021-12-30 15:42:06.005 +05:30 [DBG] Found in the cache: pn:C,pk:Litmus_App,n:Saas.Tenants.ManageConnectionStrings 2021-12-30 15:42:06.005 +05:30 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:5dc0ff50-a197-c0a3-bcbe-39f5d3e999ac,n:Saas.Tenants 2021-12-30 15:42:06.007 +05:30 [DBG] Found in the cache: pn:U,pk:5dc0ff50-a197-c0a3-bcbe-39f5d3e999ac,n:Saas.Tenants 2021-12-30 15:42:06.007 +05:30 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:Saas.Tenants 2021-12-30 15:42:06.009 +05:30 [DBG] Found in the cache: pn:R,pk:admin,n:Saas.Tenants 2021-12-30 15:42:06.009 +05:30 [DBG] PermissionStore.GetCacheItemAsync: pn:C,pk:Litmus_App,n:Saas.Tenants 2021-12-30 15:42:06.011 +05:30 [DBG] Found in the cache: pn:C,pk:Litmus_App,n:Saas.Tenants 2021-12-30 15:42:06.011 +05:30 [INF] Authorization was successful. 2021-12-30 15:42:06.016 +05:30 [INF] Executed action Volo.Saas.Host.TenantController.ApplyDatabaseMigrationsAsync (Volo.Saas.Host.HttpApi) in 34.6076ms 2021-12-30 15:42:06.016 +05:30 [INF] Executed endpoint 'Volo.Saas.Host.TenantController.ApplyDatabaseMigrationsAsync (Volo.Saas.Host.HttpApi)' 2021-12-30 15:42:06.016 +05:30 [INF] Entity Framework Core 5.0.13 initialized 'AbpAuditLoggingDbContext' using provider 'Npgsql.EntityFrameworkCore.PostgreSQL' with options: QuerySplittingBehavior=SplitQuery 2021-12-30 15:42:06.100 +05:30 [INF] Entity Framework Core 5.0.13 initialized 'BackgroundJobsDbContext' using provider 'Npgsql.EntityFrameworkCore.PostgreSQL' with options: QuerySplittingBehavior=SplitQuery 2021-12-30 15:42:06.210 +05:30 [INF] Executed DbCommand (192ms) [Parameters=[@p0='?' (DbType = Guid), @p1='?', @p2='?', @p3='?', @p4='?', @p5='?', @p6='?', @p7='?', @p8='?', @p9='?', @p10='?' (DbType = Int32), @p11='?' (DbType = DateTime), @p12='?', @p13='?', @p14='?' (DbType = Int32), @p15='?' (DbType = Guid), @p16='?' (DbType = Guid), @p17='?' (DbType = Guid), @p18='?', @p19='?', @p20='?' (DbType = Guid), @p21='?'], CommandType='"Text"', CommandTimeout='30'] INSERT INTO "AbpAuditLogs" ("Id", "ApplicationName", "BrowserInfo", "ClientId", "ClientIpAddress", "ClientName", "Comments", "ConcurrencyStamp", "CorrelationId", "Exceptions", "ExecutionDuration", "ExecutionTime", "ExtraProperties", "HttpMethod", "HttpStatusCode", "ImpersonatorTenantId", "ImpersonatorUserId", "TenantId", "TenantName", "Url", "UserId", "UserName") VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, @p13, @p14, @p15, @p16, @p17, @p18, @p19, @p20, @p21); 2021-12-30 15:42:06.291 +05:30 [INF] Executed DbCommand (190ms) [Parameters=[@__now_0='?' (DbType = DateTime), @__p_1='?' (DbType = Int32)], CommandType='"Text"', CommandTimeout='30'] SELECT a."Id", a."ConcurrencyStamp", a."CreationTime", a."ExtraProperties", a."IsAbandoned", a."JobArgs", a."JobName", a."LastTryTime", a."NextTryTime", a."Priority", a."TryCount" FROM "AbpBackgroundJobs" AS a WHERE NOT (a."IsAbandoned") AND (a."NextTryTime" <= @__now_0) ORDER BY a."Priority" DESC, a."TryCount", a."NextTryTime" LIMIT @__p_1 2021-12-30 15:42:06.403 +05:30 [INF] Executed DbCommand (192ms) [Parameters=[@p22='?' (DbType = Guid), @p23='?' (DbType = Guid), @p24='?' (DbType = Int32), @p25='?' (DbType = DateTime), @p26='?', @p27='?', @p28='?', @p29='?', @p30='?' (DbType = Guid), @p31='?' (DbType = Guid), @p32='?' (DbType = Guid), @p33='?' (DbType = Int32), @p34='?' (DbType = DateTime), @p35='?', @p36='?', @p37='?', @p38='?', @p39='?' (DbType = Guid)], CommandType='"Text"', CommandTimeout='30'] INSERT INTO "AbpAuditLogActions" ("Id", "AuditLogId", "ExecutionDuration", "ExecutionTime", "ExtraProperties", "MethodName", "Parameters", "ServiceName", "TenantId") VALUES (@p22, @p23, @p24, @p25, @p26, @p27, @p28, @p29, @p30); INSERT INTO "AbpAuditLogActions" ("Id", "AuditLogId", "ExecutionDuration", "ExecutionTime", "ExtraProperties", "MethodName", "Parameters", "ServiceName", "TenantId") VALUES (@p31, @p32, @p33, @p34, @p35, @p36, @p37, @p38, @p39); 2021-12-30 15:42:06.613 +05:30 [DBG] Added 0 entity changes to the current audit log 2021-12-30 15:42:06.613 +05:30 [DBG] Added 0 entity changes to the current audit log 2021-12-30 15:42:06.614 +05:30 [INF] Request finished HTTP/1.1 POST https://localhost:44359/api/saas/tenants/3a0117c6-98fa-f040-47e9-a37ff4a7bb46/apply-database-migrations - 0 - 204 - - 2082.6554ms 2021-12-30 15:42:11.306 +05:30 [INF] Entity Framework Core 5.0.13 initialized 'BackgroundJobsDbContext' using provider 'Npgsql.EntityFrameworkCore.PostgreSQL' with options: QuerySplittingBehavior=SplitQuery 2021-12-30 15:42:11.504 +05:30 [INF] Executed DbCommand (198ms) [Parameters=[@__now_0='?' (DbType = DateTime), @__p_1='?' (DbType = Int32)], CommandType='"Text"', CommandTimeout='30'] SELECT a."Id", a."ConcurrencyStamp", a."CreationTime", a."ExtraProperties", a."IsAbandoned", a."JobArgs", a."JobName", a."LastTryTime", a."NextTryTime", a."Priority", a."TryCount" FROM "AbpBackgroundJobs" AS a WHERE NOT (a."IsAbandoned") AND (a."NextTryTime" <= @__now_0) ORDER BY a."Priority" DESC, a."TryCount", a."NextTryTime" LIMIT @__p_1

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Sorry, I can't see any error or warning message here, can you share with me a simple project that reproduces the problem? Thanks.

  • User Avatar
    0
    vishalnikam created

    Hi,

    I can't share project. It is bit urgent, can we connect and do screen share ? if possible, ping me on skype id vis.nikam09

    Also, I don't see any background job for DB migration in "AbpBackgroundJobs" table.

    Thanks

  • User Avatar
    0
    vishalnikam created

    Hi,

    Any update?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    We can schedule a time

Made with ❤️ on ABP v9.1.0-preview. Updated on December 02, 2024, 12:35