Skip to content

Commit

Permalink
Revert "No duplicate on subscriptions"
Browse files Browse the repository at this point in the history
This reverts commit 8a6034e.
  • Loading branch information
trasher committed Aug 26, 2024
1 parent 8a6034e commit b9ba359
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
1 change: 1 addition & 0 deletions scripts/mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ CREATE TABLE galette_activities_subscriptions (
end_date date NOT NULL,
comment text,
PRIMARY KEY (id_subscription),
UNIQUE KEY (id_activity, id_adh),
FOREIGN KEY (id_activity) REFERENCES galette_activities_activities (id_activity) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (id_adh) REFERENCES galette_adherents (id_adh) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
Expand Down
3 changes: 2 additions & 1 deletion scripts/pgsql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ CREATE TABLE galette_activities_subscriptions (
subscription_date date NOT NULL,
end_date date NOT NULL,
comment text,
PRIMARY KEY (id_subscription)
PRIMARY KEY (id_subscription),
UNIQUE (id_activity, id_adh)
);
13 changes: 0 additions & 13 deletions tests/GaletteActivities/Entity/tests/units/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,6 @@ public function testCrud(): void
$member_one->loadGroups();
$groups = $member_one->getGroups();
$this->assertCount(1, $groups);

//no duplicate on subscriptions
$subscription = new \GaletteActivities\Entity\Subscription($this->zdb);
$data = [
'activity' => $gactivity_id,
'member' => $member_one->id,
'subscription_date' => (new \DateTime())->format('Y-m-d'),
'end_date' => (new \DateTime())->modify('+1 year')->format('Y-m-d'),
'comment' => 'Comment ' . $this->seed,
];
$this->assertTrue($subscription->check($data));
$this->assertTrue($subscription->store());

}

/**
Expand Down

0 comments on commit b9ba359

Please sign in to comment.