Skip to content

Commit

Permalink
Adding some performance indices and cleaning up some annotation mess.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Krulis committed May 5, 2019
1 parent ed116e7 commit 84deda3
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/model/entity/Exercise.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ public function getAuthor() {
protected $isLocked;

/**
* @ORM\Column(type="boolean")
* @ORM\Column(type="boolean", options={"default":0})
*/
protected $isBroken;
protected $isBroken = false;

public function isPublic() {
return $this->isPublic;
Expand Down
2 changes: 1 addition & 1 deletion app/model/entity/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function isDirectlyArchived(): bool {
}

/**
* @ORM\Column(type="boolean")
* @ORM\Column(type="boolean", options={"default":0})
*/
protected $isOrganizational = false;

Expand Down
2 changes: 2 additions & 0 deletions app/model/entity/Solution.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

/**
* @ORM\Entity
* @ORM\Table(indexes={@ORM\Index(name="created_at_idx", columns={"created_at"})})
*
* @method string getId()
* @method Collection getFiles()
* @method RuntimeEnvironment getRuntimeEnvironment()
Expand Down
2 changes: 1 addition & 1 deletion app/model/entity/base/ExerciseData.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

trait ExerciseData {
/**
* @ORM\Column(type="string")
* @ORM\Column(type="string", options={"default":"simpleExerciseConfig"})
*/
protected $configurationType;

Expand Down
1 change: 1 addition & 0 deletions app/model/entity/base/Submission.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

/**
* @ORM\MappedSuperclass
* @ORM\Table(indexes={@ORM\Index(name="submitted_at_idx", columns={"submitted_at"})})
*
* @method string getId()
* @method string getResultsUrl()
Expand Down
39 changes: 39 additions & 0 deletions migrations/Version20190504100254.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

namespace Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20190504100254 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}

public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('CREATE INDEX submitted_at_idx ON assignment_solution_submission (submitted_at)');
$this->addSql('CREATE INDEX submitted_at_idx ON reference_solution_submission (submitted_at)');
$this->addSql('CREATE INDEX created_at_idx ON solution (created_at)');
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('DROP INDEX submitted_at_idx ON assignment_solution_submission');
$this->addSql('DROP INDEX submitted_at_idx ON reference_solution_submission');
$this->addSql('DROP INDEX created_at_idx ON solution');
}
}

0 comments on commit 84deda3

Please sign in to comment.