mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Clean migration for main bundle
This commit is contained in:
parent
de711181df
commit
82cb359072
@ -36,7 +36,7 @@ class Center implements HasCenterInterface, \Stringable
|
|||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
|
||||||
private string $name = '';
|
private string $name = '';
|
||||||
|
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => true])]
|
||||||
private bool $isActive = true;
|
private bool $isActive = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,7 +39,7 @@ class Country
|
|||||||
* @var array<string, string>
|
* @var array<string, string>
|
||||||
*/
|
*/
|
||||||
#[Groups(['read', 'docgen:read'])]
|
#[Groups(['read', 'docgen:read'])]
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '[]', 'jsonb' => true])]
|
||||||
#[Context(['is-translatable' => true], groups: ['docgen:read'])]
|
#[Context(['is-translatable' => true], groups: ['docgen:read'])]
|
||||||
private array $name = [];
|
private array $name = [];
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class CronJobExecution
|
|||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true, options: ['default' => null])]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true, options: ['default' => null])]
|
||||||
private ?int $lastStatus = null;
|
private ?int $lastStatus = null;
|
||||||
|
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => "'{}'::jsonb", 'jsonb' => true])]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '{}', 'jsonb' => true])]
|
||||||
private array $lastExecutionData = [];
|
private array $lastExecutionData = [];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
@ -39,7 +39,7 @@ class DashboardConfigItem
|
|||||||
private ?User $user = null;
|
private ?User $user = null;
|
||||||
|
|
||||||
#[Serializer\Groups(['dashboardConfigItem:read'])]
|
#[Serializer\Groups(['dashboardConfigItem:read'])]
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '[]', 'jsonb' => true])]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '{}', 'jsonb' => true])]
|
||||||
private array $metadata = [];
|
private array $metadata = [];
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -26,7 +26,7 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
|||||||
class Location implements TrackCreationInterface, TrackUpdateInterface
|
class Location implements TrackCreationInterface, TrackUpdateInterface
|
||||||
{
|
{
|
||||||
#[Serializer\Groups(['read'])]
|
#[Serializer\Groups(['read'])]
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => true])]
|
||||||
private bool $active = true;
|
private bool $active = true;
|
||||||
|
|
||||||
#[Serializer\Groups(['read', 'write', 'docgen:read'])]
|
#[Serializer\Groups(['read', 'write', 'docgen:read'])]
|
||||||
|
@ -34,7 +34,7 @@ class LocationType
|
|||||||
final public const STATUS_REQUIRED = 'required';
|
final public const STATUS_REQUIRED = 'required';
|
||||||
|
|
||||||
#[Serializer\Groups(['read'])]
|
#[Serializer\Groups(['read'])]
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => true])]
|
||||||
private bool $active = true;
|
private bool $active = true;
|
||||||
|
|
||||||
#[Serializer\Groups(['read'])]
|
#[Serializer\Groups(['read'])]
|
||||||
@ -54,7 +54,7 @@ class LocationType
|
|||||||
private ?string $defaultFor = null;
|
private ?string $defaultFor = null;
|
||||||
|
|
||||||
#[Serializer\Groups(['read'])]
|
#[Serializer\Groups(['read'])]
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => true])]
|
||||||
private bool $editableByUsers = true;
|
private bool $editableByUsers = true;
|
||||||
|
|
||||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||||
|
@ -41,7 +41,7 @@ class Notification implements TrackUpdateInterface
|
|||||||
*
|
*
|
||||||
* @var array|string[]
|
* @var array|string[]
|
||||||
*/
|
*/
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '[]', 'jsonb' => true])]
|
||||||
private array $addressesEmails = [];
|
private array $addressesEmails = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +24,7 @@ class PermissionsGroup
|
|||||||
/**
|
/**
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '[]', 'jsonb' => true])]
|
||||||
private array $flags = [];
|
private array $flags = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +45,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
|
|||||||
/**
|
/**
|
||||||
* Array where SAML attributes's data are stored.
|
* Array where SAML attributes's data are stored.
|
||||||
*/
|
*/
|
||||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false)]
|
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false, options: ['default' => '[]', 'jsonb' => true])]
|
||||||
private array $attributes = [];
|
private array $attributes = [];
|
||||||
|
|
||||||
#[ORM\ManyToOne(targetEntity: Civility::class)]
|
#[ORM\ManyToOne(targetEntity: Civility::class)]
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Main;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
final class Version20240918150339 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Set not null and defaults on columns. Drop customs column on address';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_main_address DROP customs');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_dashboard_config_item ALTER metadata SET NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_location ALTER active SET NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_location_type ALTER active SET NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_location_type ALTER editablebyusers SET NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE country ALTER name SET NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE permission_groups ALTER name SET DEFAULT \'\'');
|
||||||
|
$this->addSql('ALTER TABLE users ALTER attributes SET DEFAULT \'[]\'');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user