Fixed error with default values on older MySQL version

We have removed the default values for the columns completly, as it were only needed on SQLite when adding the column to existing row.
As this was done in an earlier migration, we can now safely remove it.

The MySQL now correctly detects no more changes. SQLite however still generates some wrong migration changes.
This commit is contained in:
Jan Böhmer 2023-04-09 01:17:48 +02:00
parent cc033d5be7
commit fc1d2269d0
7 changed files with 212 additions and 11 deletions

View file

@ -33,14 +33,14 @@ trait TimestampTrait
{
/**
* @var DateTime|null the date when this element was modified the last time
* @ORM\Column(type="datetime", name="last_modified", options={"default"="CURRENT_TIMESTAMP"})
* @ORM\Column(type="datetime", name="last_modified", options={"default":"CURRENT_TIMESTAMP"})
* @Groups({"extended", "full"})
*/
protected ?DateTime $lastModified = null;
/**
* @var DateTime|null the date when this element was created
* @ORM\Column(type="datetime", name="datetime_added", options={"default"="CURRENT_TIMESTAMP"})
* @ORM\Column(type="datetime", name="datetime_added", options={"default":"CURRENT_TIMESTAMP"})
* @Groups({"extended", "full"})
*/
protected ?DateTime $addedDate = null;

View file

@ -78,7 +78,7 @@ class Part extends AttachmentContainingDBElement
protected $parameters;
/**
* @ORM\Column(type="datetime", name="datetime_added", options={"default"="CURRENT_TIMESTAMP"})
* @ORM\Column(type="datetime", name="datetime_added", options={"default":"CURRENT_TIMESTAMP"})
*/
protected ?DateTime $addedDate = null;
@ -104,7 +104,7 @@ class Part extends AttachmentContainingDBElement
/**
* @var DateTime the date when this element was modified the last time
* @ORM\Column(type="datetime", name="last_modified", options={"default"="CURRENT_TIMESTAMP"})
* @ORM\Column(type="datetime", name="last_modified", options={"default":"CURRENT_TIMESTAMP"})
*/
protected ?DateTime $lastModified = null;

View file

@ -100,7 +100,7 @@ class Storelocation extends AbstractPartsContainingDBElement
/**
* @var bool If this is set to true, only parts lots, which are owned by the same user as the store location are allowed to be stored here.
* @ORM\Column(type="boolean", options={"default"=false})
* @ORM\Column(type="boolean", options={"default":false})
*/
protected bool $part_owner_must_match = false;

View file

@ -88,7 +88,7 @@ class Project extends AbstractStructuralDBElement
protected bool $order_only_missing_parts = false;
/**
* @ORM\Column(type="text", nullable=false, options={"default" : ""})
* @ORM\Column(type="text", nullable=false)
* @Groups({"simple", "extended", "full"})
*/
protected string $description = '';

View file

@ -48,7 +48,7 @@ final class PermissionData implements \JsonSerializable
* permission => [
* operation => value,
* ]
* @ORM\Column(type="json", name="data", options={"default": "[]"})
* @ORM\Column(type="json", name="data")
*/
protected ?array $data = [
//$ prefixed entries are used for metadata

View file

@ -105,7 +105,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* @var string A self-description of the user
* @ORM\Column(type="text", options={"default": ""})
* @ORM\Column(type="text")
* @Groups({"full", "import"})
*/
protected string $aboutMe = '';