Skip to content

Commit 82c9b2b

Browse files
committed
Changing group-begin index on group exams into unique constraint.
1 parent 3ffbe19 commit 82c9b2b

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

app/model/entity/GroupExam.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/**
1010
* @ORM\Entity
11-
* @ORM\Table(indexes={@ORM\Index(name="group_begin_idx", columns={"group_id", "begin"})})
11+
* @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(columns={"group_id", "begin"})})
1212
* Holds history record of an exam that took place in a group.
1313
* The `examBegin`, `examEnd` fields are copied from group to `begin`, `end` fields here,
1414
* `examLockStrict` is copied to `lockStrict` field.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Migrations;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
/**
11+
* Auto-generated Migration: Please modify to your needs!
12+
*/
13+
final class Version20260122225237 extends AbstractMigration
14+
{
15+
public function getDescription(): string
16+
{
17+
return '';
18+
}
19+
20+
public function up(Schema $schema): void
21+
{
22+
// this up() migration is auto-generated, please modify it to your needs
23+
$this->addSql('ALTER TABLE group_exam DROP INDEX group_begin_idx, ADD UNIQUE INDEX UNIQ_11E1FDB6FE54D9477A859515 (group_id, begin)');
24+
}
25+
26+
public function down(Schema $schema): void
27+
{
28+
// this down() migration is auto-generated, please modify it to your needs
29+
$this->addSql('ALTER TABLE group_exam DROP INDEX UNIQ_11E1FDB6FE54D9477A859515, ADD INDEX group_begin_idx (group_id, begin)');
30+
}
31+
}

0 commit comments

Comments
 (0)