-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADVAPP-941] & [ADVAPP-973]: Fix polymorphic relationship saved values (
#1144) * Add polymorphic fixes for media and audit table for KB rename Signed-off-by: Kevin Ullyott <[email protected]> * Data migration fix for audit of renamed service_request items. Signed-off-by: Kevin Ullyott <[email protected]> * Fix table name Signed-off-by: Kevin Ullyott <[email protected]> * chore: fix enforcement of copyright on all files --------- Signed-off-by: Kevin Ullyott <[email protected]>
- Loading branch information
Showing
3 changed files
with
306 additions
and
0 deletions.
There are no files selected for viewing
118 changes: 118 additions & 0 deletions
118
...rations/2024_11_26_223109_data_fix_audit_polymorphic_types_for_service_request_rename.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?php | ||
|
||
/* | ||
<COPYRIGHT> | ||
Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. | ||
Advising App™ is licensed under the Elastic License 2.0. For more details, | ||
see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. | ||
Notice: | ||
- You may not provide the software to third parties as a hosted or managed | ||
service, where the service provides users with access to any substantial set of | ||
the features or functionality of the software. | ||
- You may not move, change, disable, or circumvent the license key functionality | ||
in the software, and you may not remove or obscure any functionality in the | ||
software that is protected by the license key. | ||
- You may not alter, remove, or obscure any licensing, copyright, or other notices | ||
of the licensor in the software. Any use of the licensor’s trademarks is subject | ||
to applicable law. | ||
- Canyon GBS LLC respects the intellectual property rights of others and expects the | ||
same in return. Canyon GBS™ and Advising App™ are registered trademarks of | ||
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks | ||
vigorously. | ||
- The software solution, including services, infrastructure, and code, is offered as a | ||
Software as a Service (SaaS) by Canyon GBS LLC. | ||
- Use of this software implies agreement to the license terms and conditions as stated | ||
in the Elastic License 2.0. | ||
For more information or inquiries please visit our website at | ||
https://www.canyongbs.com or contact us via email at [email protected]. | ||
</COPYRIGHT> | ||
*/ | ||
|
||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
return new class () extends Migration { | ||
public function up(): void | ||
{ | ||
DB::table('audits') | ||
->where('auditable_type', 'service_request_assignment') | ||
->update([ | ||
'auditable_type' => 'case_assignment', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'service_request_priority') | ||
->update([ | ||
'auditable_type' => 'case_priority', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'service_request_status') | ||
->update([ | ||
'auditable_type' => 'case_status', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'service_request_type') | ||
->update([ | ||
'auditable_type' => 'case_type', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'service_request_update') | ||
->update([ | ||
'auditable_type' => 'case_update', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'service_request') | ||
->update([ | ||
'auditable_type' => 'case_model', | ||
]); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
DB::table('audits') | ||
->where('auditable_type', 'case_assignment') | ||
->update([ | ||
'auditable_type' => 'service_request_assignment', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'case_priority') | ||
->update([ | ||
'auditable_type' => 'service_request_priority', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'case_status') | ||
->update([ | ||
'auditable_type' => 'service_request_status', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'case_type') | ||
->update([ | ||
'auditable_type' => 'service_request_type', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'case_update') | ||
->update([ | ||
'auditable_type' => 'service_request_update', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'case_model') | ||
->update([ | ||
'auditable_type' => 'service_request', | ||
]); | ||
} | ||
}; |
94 changes: 94 additions & 0 deletions
94
...grations/2024_11_26_221634_data_fix_audit_polymorphic_types_for_knowledge_base_rename.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
|
||
/* | ||
<COPYRIGHT> | ||
Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. | ||
Advising App™ is licensed under the Elastic License 2.0. For more details, | ||
see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. | ||
Notice: | ||
- You may not provide the software to third parties as a hosted or managed | ||
service, where the service provides users with access to any substantial set of | ||
the features or functionality of the software. | ||
- You may not move, change, disable, or circumvent the license key functionality | ||
in the software, and you may not remove or obscure any functionality in the | ||
software that is protected by the license key. | ||
- You may not alter, remove, or obscure any licensing, copyright, or other notices | ||
of the licensor in the software. Any use of the licensor’s trademarks is subject | ||
to applicable law. | ||
- Canyon GBS LLC respects the intellectual property rights of others and expects the | ||
same in return. Canyon GBS™ and Advising App™ are registered trademarks of | ||
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks | ||
vigorously. | ||
- The software solution, including services, infrastructure, and code, is offered as a | ||
Software as a Service (SaaS) by Canyon GBS LLC. | ||
- Use of this software implies agreement to the license terms and conditions as stated | ||
in the Elastic License 2.0. | ||
For more information or inquiries please visit our website at | ||
https://www.canyongbs.com or contact us via email at [email protected]. | ||
</COPYRIGHT> | ||
*/ | ||
|
||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
return new class () extends Migration { | ||
public function up(): void | ||
{ | ||
DB::table('audits') | ||
->where('auditable_type', 'knowledge_base_article') | ||
->update([ | ||
'auditable_type' => 'resource_hub_article', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'knowledge_base_category') | ||
->update([ | ||
'auditable_type' => 'resource_hub_category', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'knowledge_base_quality') | ||
->update([ | ||
'auditable_type' => 'resource_hub_quality', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'knowledge_base_status') | ||
->update([ | ||
'auditable_type' => 'resource_hub_status', | ||
]); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
DB::table('audits') | ||
->where('auditable_type', 'resource_hub_article') | ||
->update([ | ||
'auditable_type' => 'knowledge_base_article', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'resource_hub_category') | ||
->update([ | ||
'auditable_type' => 'knowledge_base_category', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'resource_hub_quality') | ||
->update([ | ||
'auditable_type' => 'knowledge_base_quality', | ||
]); | ||
|
||
DB::table('audits') | ||
->where('auditable_type', 'resource_hub_status') | ||
->update([ | ||
'auditable_type' => 'knowledge_base_status', | ||
]); | ||
} | ||
}; |
94 changes: 94 additions & 0 deletions
94
...grations/2024_11_26_222012_data_fix_media_polymorphic_types_for_knowledge_base_rename.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
|
||
/* | ||
<COPYRIGHT> | ||
Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. | ||
Advising App™ is licensed under the Elastic License 2.0. For more details, | ||
see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. | ||
Notice: | ||
- You may not provide the software to third parties as a hosted or managed | ||
service, where the service provides users with access to any substantial set of | ||
the features or functionality of the software. | ||
- You may not move, change, disable, or circumvent the license key functionality | ||
in the software, and you may not remove or obscure any functionality in the | ||
software that is protected by the license key. | ||
- You may not alter, remove, or obscure any licensing, copyright, or other notices | ||
of the licensor in the software. Any use of the licensor’s trademarks is subject | ||
to applicable law. | ||
- Canyon GBS LLC respects the intellectual property rights of others and expects the | ||
same in return. Canyon GBS™ and Advising App™ are registered trademarks of | ||
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks | ||
vigorously. | ||
- The software solution, including services, infrastructure, and code, is offered as a | ||
Software as a Service (SaaS) by Canyon GBS LLC. | ||
- Use of this software implies agreement to the license terms and conditions as stated | ||
in the Elastic License 2.0. | ||
For more information or inquiries please visit our website at | ||
https://www.canyongbs.com or contact us via email at [email protected]. | ||
</COPYRIGHT> | ||
*/ | ||
|
||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
return new class () extends Migration { | ||
public function up(): void | ||
{ | ||
DB::table('media') | ||
->where('model_type', 'knowledge_base_article') | ||
->update([ | ||
'model_type' => 'resource_hub_article', | ||
]); | ||
|
||
DB::table('media') | ||
->where('model_type', 'knowledge_base_category') | ||
->update([ | ||
'model_type' => 'resource_hub_category', | ||
]); | ||
|
||
DB::table('media') | ||
->where('model_type', 'knowledge_base_quality') | ||
->update([ | ||
'model_type' => 'resource_hub_quality', | ||
]); | ||
|
||
DB::table('media') | ||
->where('model_type', 'knowledge_base_status') | ||
->update([ | ||
'model_type' => 'resource_hub_status', | ||
]); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
DB::table('media') | ||
->where('model_type', 'resource_hub_article') | ||
->update([ | ||
'model_type' => 'knowledge_base_article', | ||
]); | ||
|
||
DB::table('media') | ||
->where('model_type', 'resource_hub_category') | ||
->update([ | ||
'model_type' => 'knowledge_base_category', | ||
]); | ||
|
||
DB::table('media') | ||
->where('model_type', 'resource_hub_quality') | ||
->update([ | ||
'model_type' => 'knowledge_base_quality', | ||
]); | ||
|
||
DB::table('media') | ||
->where('model_type', 'resource_hub_status') | ||
->update([ | ||
'model_type' => 'knowledge_base_status', | ||
]); | ||
} | ||
}; |