Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changes for elastic #1650

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
Loading