diff --git a/database/entities/Database/Entities/BbAttachments.php b/database/entities/Database/Entities/BbAttachments.php index dc947b64..3e156bb5 100644 --- a/database/entities/Database/Entities/BbAttachments.php +++ b/database/entities/Database/Entities/BbAttachments.php @@ -15,23 +15,22 @@ class BbAttachments /** * @var integer */ - private $postId = '0'; + private $postId; /** * @var integer */ - private $userId1 = '0'; - + private $privmsgsId = 0; /** * @var integer */ - private $privmsgsId = '0'; + private $userId1 = 0; /** * @var integer */ - private $userId2 = '0'; + private $userId2 = 0; } diff --git a/database/mappings/Database.Entities.BbAttachments.dcm.yml b/database/mappings/Database.Entities.BbAttachments.dcm.yml index 5bab886f..1b131e2d 100644 --- a/database/mappings/Database.Entities.BbAttachments.dcm.yml +++ b/database/mappings/Database.Entities.BbAttachments.dcm.yml @@ -33,20 +33,20 @@ Database\Entities\BbAttachments: nullable: false options: unsigned: true - default: '0' + default: 0 column: privmsgs_id userId1: type: integer nullable: false options: unsigned: false - default: '0' + default: 0 column: user_id_1 userId2: type: integer nullable: false options: unsigned: false - default: '0' + default: 0 column: user_id_2 lifecycleCallbacks: { } diff --git a/database/mappings/Database.Entities.BbPrivmsgs.dcm.yml b/database/mappings/Database.Entities.BbPrivmsgs.dcm.yml index 45ba4c6f..63810b6e 100644 --- a/database/mappings/Database.Entities.BbPrivmsgs.dcm.yml +++ b/database/mappings/Database.Entities.BbPrivmsgs.dcm.yml @@ -26,7 +26,7 @@ Database\Entities\BbPrivmsgs: type: boolean nullable: false options: - default: '0' + default: 0 column: privmsgs_type privmsgsSubject: type: string @@ -41,21 +41,21 @@ Database\Entities\BbPrivmsgs: nullable: false options: unsigned: false - default: '0' + default: 0 column: privmsgs_from_userid privmsgsToUserid: type: integer nullable: false options: unsigned: false - default: '0' + default: 0 column: privmsgs_to_userid privmsgsDate: type: integer nullable: false options: unsigned: false - default: '0' + default: 0 column: privmsgs_date privmsgsIp: type: string diff --git a/database/migrations/Version20170601000000.php b/database/migrations/Version20170601000000.php index 036a8f77..9f6fc5b5 100644 --- a/database/migrations/Version20170601000000.php +++ b/database/migrations/Version20170601000000.php @@ -354,12 +354,18 @@ public function up(Schema $schema) * Modify tables ******************/ - // bb_attachments + /** + * bb_attachments + * @see https://github.com/hurtom/toloka/issues/27 + */ $this->addSql('DROP INDEX attach_id_post_id ON bb_attachments'); $this->addSql('DROP INDEX post_id ON bb_attachments'); $this->addSql('ALTER TABLE bb_attachments CHANGE attach_id attach_id INT UNSIGNED NOT NULL, CHANGE post_id post_id INT UNSIGNED NOT NULL, + CHANGE privmsgs_id privmsgs_id INT UNSIGNED DEFAULT 0 NOT NULL, + CHANGE user_id_1 user_id_1 INT DEFAULT 0 NOT NULL, + CHANGE user_id_2 user_id_2 INT DEFAULT 0 NOT NULL, ADD PRIMARY KEY (attach_id, post_id), ENGINE = InnoDB'); @@ -786,6 +792,7 @@ public function up(Schema $schema) DROP privmsgs_enable_smilies, DROP privmsgs_attach_sig, DROP privmsgs_attachment, + CHANGE privmsgs_id privmsgs_id INT UNSIGNED NOT NULL, CHANGE privmsgs_subject privmsgs_subject VARCHAR(255) DEFAULT \'0\' NOT NULL, CHANGE privmsgs_ip privmsgs_ip VARCHAR(42) DEFAULT \'0\' NOT NULL COLLATE utf8_bin, ENGINE = InnoDB');