Skip to content

[ADVAPP-2635]: Rename QnA Advisors to Customer Advisors in code and database tables / columns#2530

Open
rebecca-canyon wants to merge 39 commits into
mainfrom
ADVAPP-2635-Rename-QnA-Advisors-to-Customer-Advisors-in-code-and-database-tables-columns
Open

[ADVAPP-2635]: Rename QnA Advisors to Customer Advisors in code and database tables / columns#2530
rebecca-canyon wants to merge 39 commits into
mainfrom
ADVAPP-2635-Rename-QnA-Advisors-to-Customer-Advisors-in-code-and-database-tables-columns

Conversation

@rebecca-canyon
Copy link
Copy Markdown
Contributor

@rebecca-canyon rebecca-canyon commented May 13, 2026

Ticket(s) or GitHub Issue

Technical Description

Create migration to rename tables, foreign columns, and permissions from QnA Advisors to Customer Advisors; update tests and policies in respect; update names of models, filament pages, etc

Any deployment steps required?

No

Cleanup Tasks

cleanup-tasks/2026_05_12_rename_qna_advisors_feature.md


Before contributing and submitting this PR, make sure you have Read, agree, and are compliant with the contributing guidelines.

@rebecca-canyon rebecca-canyon added the Change Type | New Feature New feature or request label May 13, 2026
@rebecca-canyon rebecca-canyon force-pushed the ADVAPP-2635-Rename-QnA-Advisors-to-Customer-Advisors-in-code-and-database-tables-columns branch 5 times, most recently from 10e9c0f to ff146e8 Compare May 20, 2026 14:40
@rebecca-canyon rebecca-canyon force-pushed the ADVAPP-2635-Rename-QnA-Advisors-to-Customer-Advisors-in-code-and-database-tables-columns branch 6 times, most recently from 54e2601 to 3fabbe3 Compare May 27, 2026 16:00
@sonarqubecloud
Copy link
Copy Markdown

@rebecca-canyon rebecca-canyon marked this pull request as ready for review May 27, 2026 16:09
@rebecca-canyon rebecca-canyon requested a review from a team as a code owner May 27, 2026 16:09
@payal-canyon payal-canyon requested review from Orrison and removed request for payal-canyon May 27, 2026 16:18
Comment on lines -101 to +105
'qna_advisor' => QnaAdvisor::class,
'qna_advisor_category' => QnaAdvisorCategory::class,
'qna_advisor_file' => QnaAdvisorFile::class,
'qna_advisor_link' => QnaAdvisorLink::class,
'qna_advisor_question' => QnaAdvisorQuestion::class,
'customer_advisor' => CustomerAdvisor::class,
'customer_advisor_category' => CustomerAdvisorCategory::class,
'customer_advisor_file' => CustomerAdvisorFile::class,
'customer_advisor_link' => CustomerAdvisorLink::class,
'customer_advisor_question' => CustomerAdvisorQuestion::class,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing that can be a little tricky about renaming these is that we need to be sure that we don't have any polymorphic relationships that COULD have referenced these old names previously. Or else it would now fail to resolve those records.

If we want to be careful, you can keep the old key names, referencing the new class names, AFTER the definitions of the new string / class names. Like this:

'customer_advisor' => CustomerAdvisor::class,
'customer_advisor_category' => CustomerAdvisorCategory::class,
'customer_advisor_file' => CustomerAdvisorFile::class,
'customer_advisor_link' => CustomerAdvisorLink::class,
'customer_advisor_question' => CustomerAdvisorQuestion::class,
'qna_advisor' => CustomerAdvisor::class, // LEGACY, kept for backward compatibility
'qna_advisor_category' => CustomerAdvisorCategory::class, // LEGACY, kept for backward compatibility
'qna_advisor_file' => CustomerAdvisorFile::class, // LEGACY, kept for backward compatibility
'qna_advisor_link' => CustomerAdvisorLink::class, // LEGACY, kept for backward compatibility
'qna_advisor_question' => CustomerAdvisorQuestion::class, // LEGACY, kept for backward compatibility

This way, when NEW records are written, it will find the first morphmap record referencing CustomerAdvisor and save with customer_advisor, but then on READ out of the DB it will be able to still map qna_advisor to the new class FQCN

You also can get rid of / NOT do the legacy backwards compatibility items if you feel strongly that there are none, or you have a migration that renames all references to it in an pertinent DB column.

Comment thread app-modules/ai/routes/widgets.php
@rebecca-canyon rebecca-canyon force-pushed the ADVAPP-2635-Rename-QnA-Advisors-to-Customer-Advisors-in-code-and-database-tables-columns branch from af415c1 to 7878ac0 Compare June 3, 2026 04:56
@rebecca-canyon rebecca-canyon requested a review from Orrison June 3, 2026 06:26
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than actually writing out the same routes, you could define all the grouped routes in like a variable stored function and call it for both. That way this is smaller and easier to maintain. This is very rough, but something like:

$registerAdvisorRoutes = function () {
    Route::prefix('api/{advisor}')
        ->name('api.')
        ->middleware([
            EnsureCustomerAdvisorEmbedIsEnabled::class,
            EnsureCustomerAdvisorRequestComingFromAuthorizedDomain::class,
        ])
        ->group(function () {
            Route::get('/', CustomerAdvisorResourcesController::class)->name('assets');
            Route::post('/entry', ShowAdvisorController::class)->name('entry');
            // ... all the other routes ...
        });

    Route::get('{file?}', CustomerAdvisorResourceController::class)
        ->where('file', '(.*)')
        ->name('asset');
};

// Primary routes
Route::middleware(['api', EncryptCookies::class, CustomerAdvisorWidgetCors::class])
    ->name('widgets.ai.customer-advisors.')
    ->prefix('widgets/ai/customer-advisors')
    ->group($registerAdvisorRoutes);

// Legacy support
Route::middleware(['api', EncryptCookies::class, CustomerAdvisorWidgetCors::class])
    ->name('widgets.ai.qna-advisors.')
    ->prefix('widgets/ai/qna-advisors')
    ->group($registerAdvisorRoutes);

@rebecca-canyon rebecca-canyon requested a review from Orrison June 5, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Change Type | New Feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants