From 6254303392b7d023c4e9c87eeae882197e5e8b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 16 Feb 2023 14:08:16 +0100 Subject: [PATCH] Revert "Feature: [docgen][stored object] update model to store status, template_id and fix defaults" This reverts commit 55918bcafb9b958e83696a9eaa4f6f17e90a9602. --- .../migrations/Version20230214192558.php | 47 ------------------- .../Entity/StoredObject.php | 10 ++-- 2 files changed, 7 insertions(+), 50 deletions(-) delete mode 100644 src/Bundle/ChillDocGeneratorBundle/migrations/Version20230214192558.php diff --git a/src/Bundle/ChillDocGeneratorBundle/migrations/Version20230214192558.php b/src/Bundle/ChillDocGeneratorBundle/migrations/Version20230214192558.php deleted file mode 100644 index de536ca84..000000000 --- a/src/Bundle/ChillDocGeneratorBundle/migrations/Version20230214192558.php +++ /dev/null @@ -1,47 +0,0 @@ -addSql('ALTER TABLE chill_doc.stored_object ADD template_id INT DEFAULT NULL'); - $this->addSql('ALTER TABLE chill_doc.stored_object ADD status TEXT DEFAULT \'ready\' NOT NULL'); - $this->addSql('ALTER TABLE chill_doc.stored_object ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); - $this->addSql('UPDATE chill_doc.stored_object SET createdAt = creation_date'); - $this->addSql('ALTER TABLE chill_doc.stored_object ADD createdBy_id INT DEFAULT NULL'); - $this->addSql('ALTER TABLE chill_doc.stored_object DROP creation_date;'); - $this->addSql('ALTER TABLE chill_doc.stored_object ALTER type SET DEFAULT \'\''); - $this->addSql('ALTER TABLE chill_doc.stored_object ALTER title DROP DEFAULT'); - $this->addSql('COMMENT ON COLUMN chill_doc.stored_object.createdAt IS \'(DC2Type:datetime_immutable)\''); - $this->addSql('ALTER TABLE chill_doc.stored_object ADD CONSTRAINT FK_49604E365DA0FB8 FOREIGN KEY (template_id) REFERENCES chill_docgen_template (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE chill_doc.stored_object ADD CONSTRAINT FK_49604E363174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('CREATE INDEX IDX_49604E365DA0FB8 ON chill_doc.stored_object (template_id)'); - $this->addSql('CREATE INDEX IDX_49604E363174800F ON chill_doc.stored_object (createdBy_id)'); - } - - public function down(Schema $schema): void - { - $this->addSql('ALTER TABLE chill_doc.stored_object DROP CONSTRAINT FK_49604E365DA0FB8'); - $this->addSql('ALTER TABLE chill_doc.stored_object DROP CONSTRAINT FK_49604E363174800F'); - $this->addSql('ALTER TABLE chill_doc.stored_object DROP template_id'); - $this->addSql('ALTER TABLE chill_doc.stored_object DROP status'); - $this->addSql('ALTER TABLE chill_doc.stored_object ADD creation_date TIMESTAMP(0) DEFAULT NOW()'); - $this->addSql('UPDATE chill_doc.stored_object SET creation_date = createdAt'); - $this->addSql('ALTER TABLE chill_doc.stored_object DROP createdAt'); - $this->addSql('ALTER TABLE chill_doc.stored_object DROP createdBy_id'); - $this->addSql('ALTER TABLE chill_doc.stored_object ALTER title SET DEFAULT \'\''); - $this->addSql('ALTER TABLE chill_doc.stored_object ALTER type DROP DEFAULT'); - } -} diff --git a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php index ab09f870f..21abc1f56 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php @@ -41,6 +41,12 @@ class StoredObject implements AsyncFileInterface, Document, TrackCreationInterfa use TrackCreationTrait; + /** + * @ORM\Column(type="datetime", name="creation_date") + * @Serializer\Groups({"read", "write"}) + */ + private DateTimeInterface $creationDate; + /** * @ORM\Column(type="json", name="datas") * @Serializer\Groups({"read", "write"}) @@ -81,7 +87,7 @@ class StoredObject implements AsyncFileInterface, Document, TrackCreationInterfa private string $title = ''; /** - * @ORM\Column(type="text", name="type", options={"default": ""}) + * @ORM\Column(type="text", name="type") * @Serializer\Groups({"read", "write"}) */ private string $type = ''; @@ -113,7 +119,6 @@ class StoredObject implements AsyncFileInterface, Document, TrackCreationInterfa /** * @Serializer\Groups({"read", "write"}) - * @deprecated */ public function getCreationDate(): DateTime { @@ -180,7 +185,6 @@ class StoredObject implements AsyncFileInterface, Document, TrackCreationInterfa /** * @Serializer\Groups({"write"}) - * @deprecated */ public function setCreationDate(DateTime $creationDate): self {