Open Closed

The New Default include SaaS #5047


User avatar
0
BringerOD created

How do you remove the SaaS module from the new abp suite or abp cli create commands.

We dont need the SaaS features, how do you remove it?

  • ABP Framework version: vLatest
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

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

    hi

    1. remove all saas packages from csprojfiles.(Volo.Saas.XXX)

    2. remove all saas modules from csfiles.(VoloSaasXXXModule)

    3. remove @volo/saas from package.json

    4. remove ConfigureSaas from DbContext

    Build your solution and remove the namespaces and use;

    Recreate migrations after building success.

  • User Avatar
    0
    BringerOD created

    Volo.Saas

    By default you add all this into the XXXDbMigrationService.cs in the domain project. Is there a way to remove it

    ` public async Task MigrateAsync() { var initialMigrationAdded = AddInitialMigrationIfNotExist();

        if (initialMigrationAdded)
        {
            return;
        }
    
        Logger.LogInformation("Started database migrations...");
    
        await MigrateDatabaseSchemaAsync();
        await SeedDataAsync();
    
        Logger.LogInformation("Successfully completed host database migrations.");
    
        var tenants = await _tenantRepository.GetListAsync(includeDetails: true);
    
        var migratedDatabaseSchemas = new HashSet<string>();
        foreach (var tenant in tenants)
        {
            using (_currentTenant.Change(tenant.Id))
            {
                if (tenant.ConnectionStrings.Any())
                {
                    var tenantConnectionStrings = tenant.ConnectionStrings
                        .Select(x => x.Value)
                        .ToList();
    
                    if (!migratedDatabaseSchemas.IsSupersetOf(tenantConnectionStrings))
                    {
                        await MigrateDatabaseSchemaAsync(tenant);
    
                        migratedDatabaseSchemas.AddIfNotContains(tenantConnectionStrings);
                    }
                }
    
                await SeedDataAsync(tenant);
            }
    
            Logger.LogInformation($"Successfully completed {tenant.Name} tenant database migrations.");
        }
    
        Logger.LogInformation("Successfully completed all database migrations.");
        Logger.LogInformation("You can safely end this process...");
    }
    
    private async Task MigrateDatabaseSchemaAsync(Tenant? tenant = null)
    {
        Logger.LogInformation(
            $"Migrating schema for {(tenant == null ? "host" : tenant.Name + " tenant")} database...");
    
        foreach (var migrator in _dbSchemaMigrators)
        {
            await migrator.MigrateAsync();
        }
    }
    
    private async Task SeedDataAsync(Tenant? tenant = null)
    {
        Logger.LogInformation($"Executing {(tenant == null ? "host" : tenant.Name + " tenant")} database seed...");
    
        await _dataSeeder.SeedAsync(new DataSeedContext(tenant?.Id)
            .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName,
                TTBConsts.AdminEmailDefaultValue)
            .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName,
                TTBConsts.AdminPasswordDefaultValue)
        );
    }
    

    `

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can remove the tenant related code and MyProjectNameTenantDatabaseMigrationHandler.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11