Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2feba57cb6 | |||
| f74f0e1ad3 | |||
| 6db6d13e76 | |||
| 26fae393cf |
+1
-1
@@ -1,2 +1,2 @@
|
||||
parameters:
|
||||
app.version: '0.4.7'
|
||||
app.version: '0.4.9'
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Seed the default absence policies (Syntec / IDCC 1486 legal baseline).
|
||||
*
|
||||
* These rows were previously created only by AppFixtures, so they existed in
|
||||
* dev but never in production: the "Politiques d'absence" admin screen was
|
||||
* empty in prod. This data migration seeds the same 6 policies idempotently
|
||||
* (ON CONFLICT on the unique `type` index), so prod gets populated and dev,
|
||||
* where fixtures already created them, is left untouched.
|
||||
*
|
||||
* Values mirror AppFixtures and the legal compliance design
|
||||
* (docs/superpowers/specs/2026-05-22-absence-legal-compliance-fixes-design.md):
|
||||
* - CP: 25 jours ouvrés/an, préavis 30 j, pas de justificatif.
|
||||
* - Mariage/PACS: 4 j/événement ; Naissance: 3 j/événement.
|
||||
* - Décès / Congé parental / Maladie: pas de forfait codé en dur
|
||||
* (montant selon lien de parenté ou suspension), justificatif requis.
|
||||
*/
|
||||
final class Version20260526100000 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Seed default absence policies (Syntec IDCC 1486) idempotently for prod';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// [type, days_per_year, days_per_event, justification_required, notice_days, count_working_days_only]
|
||||
$policies = [
|
||||
['cp', '25', null, 'false', 30, 'true'],
|
||||
['mariage_pacs', null, '4', 'true', 0, 'true'],
|
||||
['naissance', null, '3', 'true', 0, 'true'],
|
||||
['conge_parental', null, null, 'true', 30, 'true'],
|
||||
['deces', null, null, 'true', 0, 'true'],
|
||||
['maladie', null, null, 'true', 0, 'true'],
|
||||
];
|
||||
|
||||
foreach ($policies as [$type, $daysPerYear, $daysPerEvent, $justif, $notice, $workingOnly]) {
|
||||
$daysPerYear = null === $daysPerYear ? 'NULL' : $daysPerYear;
|
||||
$daysPerEvent = null === $daysPerEvent ? 'NULL' : $daysPerEvent;
|
||||
|
||||
$this->addSql(<<<SQL
|
||||
INSERT INTO absence_policy
|
||||
(type, days_per_year, days_per_event, justification_required, notice_days, count_working_days_only, active)
|
||||
VALUES
|
||||
('{$type}', {$daysPerYear}, {$daysPerEvent}, {$justif}, {$notice}, {$workingOnly}, true)
|
||||
ON CONFLICT (type) DO NOTHING
|
||||
SQL);
|
||||
}
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql("DELETE FROM absence_policy WHERE type IN ('cp', 'mariage_pacs', 'naissance', 'conge_parental', 'deces', 'maladie')");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user