Skip to content

Commit

Permalink
[db] Adjust PK for bb_attachments (hurtom#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
yukoff committed Aug 20, 2017
1 parent 0a5ff89 commit ef51aa1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion database/entities/Database/Entities/BbAttachments.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BbAttachments
/**
* @var integer
*/
private $postId;
private $postId = 0;

/**
* @var integer
Expand Down
4 changes: 3 additions & 1 deletion database/mappings/Database.Entities.BbAttachments.dcm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,18 @@ Database\Entities\BbAttachments:
nullable: false
options:
unsigned: true
default: 0
id: true
column: post_id
fields:
privmsgsId:
type: integer
nullable: false
options:
unsigned: true
default: 0
id: true
column: privmsgs_id
fields:
userId1:
type: integer
nullable: false
Expand Down
4 changes: 2 additions & 2 deletions database/migrations/Version20170601000000.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,11 @@ public function up(Schema $schema)
$this->addSql('DROP INDEX attach_id_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 post_id post_id INT UNSIGNED DEFAULT 0 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),
ADD PRIMARY KEY (attach_id, post_id, privmsgs_id),
ENGINE = InnoDB');

// bb_attachments_config
Expand Down

0 comments on commit ef51aa1

Please sign in to comment.