Skip to content

Commit

Permalink
Merge pull request #1596 from ConductionNL/feature/default-version
Browse files Browse the repository at this point in the history
Added version = 0.0.1 as default value for all Entity
  • Loading branch information
WilcoLouwerse authored Dec 19, 2023
2 parents 7ea7fbc + c35e075 commit a2b25db
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 12 deletions.
51 changes: 51 additions & 0 deletions api/migrations/Version20231219151046.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?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 Version20231219151046 extends AbstractMigration
{
public function getDescription(): string
{
return 'Set version default to 0.0.1';
}

public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE action ALTER version SET DEFAULT \'0.0.1\'');
$this->addSql('ALTER TABLE application ALTER version SET DEFAULT \'0.0.1\'');
$this->addSql('ALTER TABLE collection_entity ALTER version SET DEFAULT \'0.0.1\'');
$this->addSql('ALTER TABLE cronjob ALTER version SET DEFAULT \'0.0.1\'');
$this->addSql('ALTER TABLE endpoint ALTER version SET DEFAULT \'0.0.1\'');
$this->addSql('ALTER TABLE entity ALTER version SET DEFAULT \'0.0.1\'');
$this->addSql('ALTER TABLE gateway ALTER version SET DEFAULT \'0.0.1\'');
$this->addSql('ALTER TABLE mapping ALTER version SET DEFAULT \'0.0.1\'');
$this->addSql('ALTER TABLE organization ALTER version SET DEFAULT \'0.0.1\'');
$this->addSql('ALTER TABLE security_group ALTER version SET DEFAULT \'0.0.1\'');
$this->addSql('ALTER TABLE template ALTER version SET DEFAULT \'0.0.1\'');
$this->addSql('ALTER TABLE "user" ALTER version SET DEFAULT \'0.0.1\'');
}

public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE action ALTER version SET DEFAULT NULL');
$this->addSql('ALTER TABLE application ALTER version SET DEFAULT NULL');
$this->addSql('ALTER TABLE collection_entity ALTER version SET DEFAULT NULL');
$this->addSql('ALTER TABLE cronjob ALTER version SET DEFAULT NULL');
$this->addSql('ALTER TABLE endpoint ALTER version SET DEFAULT NULL');
$this->addSql('ALTER TABLE entity ALTER version SET DEFAULT NULL');
$this->addSql('ALTER TABLE gateway ALTER version SET DEFAULT NULL');
$this->addSql('ALTER TABLE mapping ALTER version SET DEFAULT NULL');
$this->addSql('ALTER TABLE organization ALTER version SET DEFAULT NULL');
$this->addSql('ALTER TABLE security_group ALTER version SET DEFAULT NULL');
$this->addSql('ALTER TABLE template ALTER version SET DEFAULT NULL');
$this->addSql('ALTER TABLE "user" ALTER version SET DEFAULT NULL');
}
}
2 changes: 1 addition & 1 deletion api/src/Entity/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Action
*
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $version;
private ?string $version = '0.0.1';

/**
* @var string The name of the action
Expand Down
2 changes: 1 addition & 1 deletion api/src/Entity/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Application
*
* @ORM\Column(type="string", length=255, nullable=true, options={"default": null})
*/
private ?string $version = null;
private ?string $version = '0.0.1';

/**
* The hosts that this applications uses, keep in ind that a host is exluding a trailing slach / and https:// ot http://.
Expand Down
2 changes: 1 addition & 1 deletion api/src/Entity/CollectionEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class CollectionEntity
*
* @ORM\Column(type="string", length=255, nullable=true, options={"default": null})
*/
private ?string $version = null;
private ?string $version = '0.0.1';

/**
* @var ?string The location where the OAS can be loaded from
Expand Down
2 changes: 1 addition & 1 deletion api/src/Entity/Cronjob.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Cronjob
*
* @ORM\Column(type="string", length=255, nullable=true, options={"default": null})
*/
private ?string $version = null;
private ?string $version = '0.0.1';

/**
* @var string The crontab that determines the interval https://crontab.guru/
Expand Down
2 changes: 1 addition & 1 deletion api/src/Entity/Endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class Endpoint
*
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $version = null;
private ?string $version = '0.0.1';

/**
* Constructor for creating an Endpoint. Use $entity to create an Endpoint for an Entity or
Expand Down
2 changes: 1 addition & 1 deletion api/src/Entity/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ class Entity
*
* @ORM\Column(type="string", length=255, nullable=true, options={"default": null})
*/
private ?string $version = null;
private ?string $version = '0.0.1';

//todo: do we want read/write groups here?
/**
Expand Down
2 changes: 1 addition & 1 deletion api/src/Entity/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class Gateway
*
* @ORM\Column(type="string", length=255, nullable=true, options={"default": null})
*/
private ?string $version = null;
private ?string $version = '0.0.1';

/**
* @var string The location where the Gateway needs to be accessed
Expand Down
2 changes: 1 addition & 1 deletion api/src/Entity/Mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Mapping
*
* @ORM\Column(type="string", length=255, nullable=true, options={"default": null})
*/
private ?string $version = null;
private ?string $version = '0.0.1';

/**
* @var string The name of the mapping
Expand Down
2 changes: 1 addition & 1 deletion api/src/Entity/Organization.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class Organization
*
* @ORM\Column(type="string", length=255, nullable=true, options={"default": null})
*/
private ?string $version = null;
private ?string $version = '0.0.1';

/**
* @Groups({"read", "write"})
Expand Down
2 changes: 1 addition & 1 deletion api/src/Entity/SecurityGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class SecurityGroup
*
* @ORM\Column(type="string", length=255, nullable=true, options={"default": null})
*/
private ?string $version = null;
private ?string $version = '0.0.1';

/**
* @Groups({"read", "write"})
Expand Down
2 changes: 1 addition & 1 deletion api/src/Entity/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class Template
*
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $version = null;
private ?string $version = '0.0.1';

/**
* @var Datetime|null The moment this resource was created
Expand Down
2 changes: 1 addition & 1 deletion api/src/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class User implements PasswordAuthenticatedUserInterface
*
* @ORM\Column(type="string", length=255, nullable=true, options={"default": null})
*/
private ?string $version = null;
private ?string $version = '0.0.1';

/**
* @Groups({"write"})
Expand Down

0 comments on commit a2b25db

Please sign in to comment.