Skip to content

Commit

Permalink
Merge pull request #1650 from ConductionNL/feature/woo-157/updates-fo…
Browse files Browse the repository at this point in the history
…r-elastic

Add changes for elastic
  • Loading branch information
rjzondervan authored May 30, 2024
2 parents b3fb6a4 + d04edff commit f748c87
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 1 deletion.
33 changes: 33 additions & 0 deletions api/migrations/Version20240516090339.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

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

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240516090339 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->addSql('ALTER TABLE database ADD type VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE database ADD auth VARCHAR(255) DEFAULT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE database DROP type');
$this->addSql('ALTER TABLE database DROP auth');
}
}
2 changes: 1 addition & 1 deletion api/src/Entity/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class Application
private array $certificates = [];

/**
* @var array Allowed CORS origins for this application.
* @var array|null Allowed CORS origins for this application.
*
* @Groups({"read", "write"})
*
Expand Down
56 changes: 56 additions & 0 deletions api/src/Entity/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,26 @@ class Database
*/
private string $uri;

/**
* @var string The type of database, choose from mongodb and elasticsearch
*
* @Assert\NotNull
* @Assert\Choice({"mongodb", "elasticsearch"})
* @Groups({"read","write"})
*
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $type = 'mongodb';

/**
* @var string Auth parameter that cannot be stored in the URL, like the API key for ElasticSearch
*
* @Groups({"write"})
*
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $auth = null;

/**
* The organizations that use this Database.
*
Expand Down Expand Up @@ -365,4 +385,40 @@ public function setDateModified(DateTimeInterface $dateModified): self

return $this;
}

/**
* @return string|null
*/
public function getAuth(): ?string
{
return $this->auth;
}

/**
* @param string|null $auth
*/
public function setAuth(?string $auth): self
{
$this->auth = $auth;

return $this;
}

/**
* @return string|null
*/
public function getType(): ?string
{
return $this->type;
}

/**
* @param string $type
*/
public function setType(string $type = 'mongodb'): self
{
$this->type = $type;

return $this;
}
}

0 comments on commit f748c87

Please sign in to comment.