diff --git a/Entity/DocumentCategory.php b/Entity/DocumentCategory.php index 82fe30984..29d02efb4 100644 --- a/Entity/DocumentCategory.php +++ b/Entity/DocumentCategory.php @@ -7,6 +7,7 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** + * @ORM\Table("chill_doc.document_category") * @ORM\Entity(repositoryClass="Chill\DocStoreBundle\EntityRepository\DocumentCategoryRepository") */ class DocumentCategory diff --git a/Entity/PersonDocument.php b/Entity/PersonDocument.php index a0aefbb10..b38023ddb 100644 --- a/Entity/PersonDocument.php +++ b/Entity/PersonDocument.php @@ -11,6 +11,7 @@ use Chill\PersonBundle\Entity\Person; /** + * @ORM\Table("chill_doc.person_document") * @ORM\Entity() */ class PersonDocument extends Document implements HasCenterInterface, HasScopeInterface diff --git a/Resources/migrations/Version20180322123800.php b/Resources/migrations/Version20180322123800.php deleted file mode 100644 index dc77d78c5..000000000 --- a/Resources/migrations/Version20180322123800.php +++ /dev/null @@ -1,45 +0,0 @@ -addSql("CREATE SEQUENCE PersonDocument_id_seq INCREMENT BY 1 MINVALUE 1 START 1;"); - $this->addSql("CREATE TABLE DocumentCategory (bundle_id VARCHAR(255) NOT NULL, id_inside_bundle INT NOT NULL, name JSON NOT NULL, document_class VARCHAR(255) NOT NULL, PRIMARY KEY(bundle_id, id_inside_bundle));"); - $this->addSql("COMMENT ON COLUMN DocumentCategory.name IS '(DC2Type:json_array)';"); - $this->addSql("CREATE TABLE PersonDocument (id INT NOT NULL, category_bundle_id VARCHAR(255) DEFAULT NULL, category_id_inside_bundle INT DEFAULT NULL, scope_id INT DEFAULT NULL, user_id INT DEFAULT NULL, person_id INT DEFAULT NULL, title TEXT NOT NULL, description TEXT NOT NULL, content TEXT NOT NULL, date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id));"); - $this->addSql("CREATE INDEX IDX_BAADC20C369A0BE36EF62EFC ON PersonDocument (category_bundle_id, category_id_inside_bundle);"); - $this->addSql("CREATE INDEX IDX_BAADC20C682B5931 ON PersonDocument (scope_id);"); - $this->addSql("CREATE INDEX IDX_BAADC20CA76ED395 ON PersonDocument (user_id);"); - $this->addSql("CREATE INDEX IDX_BAADC20C217BBB47 ON PersonDocument (person_id);"); - $this->addSql("ALTER TABLE PersonDocument ADD CONSTRAINT FK_BAADC20C369A0BE36EF62EFC FOREIGN KEY (category_bundle_id, category_id_inside_bundle) REFERENCES DocumentCategory (bundle_id, id_inside_bundle) NOT DEFERRABLE INITIALLY IMMEDIATE;"); - $this->addSql("ALTER TABLE PersonDocument ADD CONSTRAINT FK_BAADC20C682B5931 FOREIGN KEY (scope_id) REFERENCES scopes (id) NOT DEFERRABLE INITIALLY IMMEDIATE;"); - $this->addSql("ALTER TABLE PersonDocument ADD CONSTRAINT FK_BAADC20CA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE;"); - $this->addSql("ALTER TABLE PersonDocument ADD CONSTRAINT FK_BAADC20C217BBB47 FOREIGN KEY (person_id) REFERENCES Person (id) NOT DEFERRABLE INITIALLY IMMEDIATE;"); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $this->addSql("ALTER TABLE PersonDocument DROP CONSTRAINT FK_BAADC20C369A0BE36EF62EFC"); - $this->addSql("ALTER TABLE PersonDocument DROP CONSTRAINT FK_BAADC20C682B5931"); - $this->addSql("ALTER TABLE PersonDocument DROP CONSTRAINT FK_BAADC20CA76ED395"); - $this->addSql("ALTER TABLE PersonDocument DROP CONSTRAINT FK_BAADC20C217BBB47"); - $this->addSql("DROP TABLE DocumentCategory;"); - $this->addSql("DROP TABLE PersonDocument;"); - $this->addSql("DROP SEQUENCE PersonDocument_id_seq;"); - } -}