Open Closed

MySqlConnector.MySqlException (0x80004005): Table '*.AbpSessions' doesn't exist #8172


User avatar
0
zhongfang created
  • ABP Framework version: v8.3.0
  • **Blazor Server
  • Database System: EF Core (MySQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
MySqlConnector.MySqlException (0x80004005): Table '****.AbpSessions' doesn't exist
  • Steps to reproduce the issue: I upgrade my solution to 8.3.0. Perhaps I have added some module? Now I got above error.

5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You should add new ef core migrations and update the database.

  • User Avatar
    0
    zhongfang created

    I am very practices with ef core migrations.

    Perhaps I missed any module or fuction call?

    [ReplaceDbContext(typeof(IIdentityProDbContext))]
    [ReplaceDbContext(typeof(ISaasDbContext))]
    [ConnectionStringName("Default")]
    public class BlazorOneDbContext :
        AbpDbContext<BlazorOneDbContext>,
        IIdentityProDbContext,
        ISaasDbContext
    {
        /* Add DbSet properties for your Aggregate Roots / Entities here. */
    
        #region Entities from the modules
    
        /* Notice: We only implemented IIdentityProDbContext and ISaasDbContext
         * and replaced them for this DbContext. This allows you to perform JOIN
         * queries for the entities of these modules over the repositories easily. You
         * typically don't need that for other modules. But, if you need, you can
         * implement the DbContext interface of the needed module and use ReplaceDbContext
         * attribute just like IIdentityProDbContext and ISaasDbContext.
         *
         * More info: Replacing a DbContext of a module ensures that the related module
         * uses this DbContext on runtime. Otherwise, it will use its own DbContext class.
         */
    
        // Identity
        public DbSet<IdentityUser> Users { get; set; }
        public DbSet<IdentityRole> Roles { get; set; }
        public DbSet<IdentitySession> Sessions { get; set; }
        public DbSet<IdentityClaimType> ClaimTypes { get; set; }
        public DbSet<OrganizationUnit> OrganizationUnits { get; set; }
        public DbSet<IdentitySecurityLog> SecurityLogs { get; set; }
        public DbSet<IdentityLinkUser> LinkUsers { get; set; }
        public DbSet<IdentityUserDelegation> UserDelegations { get; }
    
        // SaaS
        public DbSet<Tenant> Tenants { get; set; }
        public DbSet<Edition> Editions { get; set; }
        public DbSet<TenantConnectionString> TenantConnectionStrings { get; set; }
    
        #endregion
    
        public BlazorOneDbContext(DbContextOptions<BlazorOneDbContext> options)
            : base(options)
        {
    
        }
    
        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);
    
            /* Include modules to your migration db context */
    
            builder.ConfigurePermissionManagement();
            builder.ConfigureSettingManagement();
            builder.ConfigureBackgroundJobs();
            builder.ConfigureAuditLogging();
            builder.ConfigureIdentityPro();
            builder.ConfigureOpenIddict();
            builder.ConfigureFeatureManagement();
            builder.ConfigureLanguageManagement();
            builder.ConfigureSaas();
            builder.ConfigureTextTemplateManagement();
            builder.ConfigureBlobStoring();
            builder.ConfigureGdpr();
        ~~~
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Looks your DbContext no problem.

    What happens if you run the dotnet ef migrations add NewTest command?

  • User Avatar
    0
    zhongfang created

    Oh, after I run the dotnet ef migrations add... The problem has been resolved.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Good news.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35