feat: extend job-profile and feedback entities for future statistics
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20251218100001 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Backfill assignment_id and job_profile_category on feedback table from existing disposition data';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// Backfill assignment_id from disposition's feedback relation
|
||||
$this->addSql('
|
||||
UPDATE feedback f
|
||||
INNER JOIN disposition d ON d.feedback_id = f.id
|
||||
SET f.assignment_id = d.assignment_id
|
||||
WHERE f.assignment_id IS NULL
|
||||
');
|
||||
|
||||
// Backfill job_profile_category from assignment's job profile
|
||||
$this->addSql('
|
||||
UPDATE feedback f
|
||||
INNER JOIN assignment a ON a.id = f.assignment_id
|
||||
INNER JOIN job_profile jp ON jp.id = a.job_profile_id
|
||||
SET f.job_profile_category = jp.category
|
||||
WHERE f.job_profile_category IS NULL
|
||||
AND f.assignment_id IS NOT NULL
|
||||
');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// Data migration - setting to NULL on rollback
|
||||
$this->addSql('UPDATE feedback SET assignment_id = NULL, job_profile_category = NULL');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user