Skip to content

Commit

Permalink
Ajuste la contrainte des unités de matériel dans les événements (#77)
Browse files Browse the repository at this point in the history
(Sera rollback lorsque l'on prendra en charge les guards lors du switch-back Gestion unitaire => Gestion non unitaire)
  • Loading branch information
Donov4n authored Dec 29, 2020
1 parent 2d0a828 commit f0bbab2
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
use Phinx\Migration\AbstractMigration;

class ChangesMaterialUnitsConstraint extends AbstractMigration
{
public function up()
{
$table = $this->table('event_material_units');
$table->dropForeignKey('material_unit_id')->save();
$table
->addForeignKey('material_unit_id', 'material_units', 'id', [
'delete' => 'CASCADE',
'update' => 'NO_ACTION',
'constraint' => 'fk_event_material_unit_material_unit',
])
->save();
}

public function down()
{
$table = $this->table('event_material_units');
$table->dropForeignKey('material_unit_id')->save();
$table
->addForeignKey('material_unit_id', 'material_units', 'id', [
'delete' => 'RESTRICT',
'update' => 'NO_ACTION',
'constraint' => 'fk_event_material_unit_material_unit',
])
->save();
}
}

0 comments on commit f0bbab2

Please sign in to comment.