Open Closed

How can I change the database table prefix? #1259


User avatar
0
alper created
Support Team Director

I would like to change the database table prefix for IdentityServer.


1 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director

    The table prefix change must be done in BookStoreEfCoreEntityExtensionMappings.cs file. All modules have static variables to be able to change the database table prefix. After changing the table prefix, you need to add a new migration and apply it to the database.

       OneTimeRunner.Run(() =>
        {
            string newDbTablePrefix = "Abc";
            AbpIdentityDbProperties.DbTablePrefix = newDbTablePrefix; //Identity
            AbpIdentityServerDbProperties.DbTablePrefix = newDbTablePrefix; //Identity Server
            AbpAuditLoggingDbProperties.DbTablePrefix = newDbTablePrefix; //Audit Logging
            FileManagementDbProperties.DbTablePrefix = newDbTablePrefix; //File Management
            LanguageManagementDbProperties.DbTablePrefix = newDbTablePrefix; //Language Management
            SaasDbProperties.DbTablePrefix = newDbTablePrefix; //SaaS
            TextTemplateManagementDbProperties.DbTablePrefix = newDbTablePrefix; //Text Template
            PaymentDbProperties.DbTablePrefix = newDbTablePrefix; //Payment
            AbpPermissionManagementDbProperties.DbTablePrefix = newDbTablePrefix; //Permission Management        
        });
    

    See the location where you need to write this code

    In the corresponding module document, you can see the static variable of the table prefix. Identity Module: File Management Module:


    Add new migration to create the migration script

Made with ❤️ on ABP v9.0.0-preview. Updated on October 07, 2024, 08:52