プロジェクト

全般

プロフィール

Bug(バグ) #1483

マイグレート後のDB構造が新規構築時と一致しない

Masato Nagasawa13年以上前に追加. 12年以上前に更新.

ステータス:
Fixed(完了)
優先度:
High(高め)
担当者:
対象バージョン:
開始日:
2010-08-05
期日:
進捗率:

100%

3.6 で発生するか:
Yes
[QA]バグ通知済:
はい
3.8 で発生するか:
Unknown (未調査)
opCommunityTopicPlugin 絞込条件:

説明

Overview (現象)

post, file に関してのインデックスとカスケーディングデリートの情報がマイグレート時に付加されていない。

新規インストール時

mysql> SHOW CREATE TABLE community_topic_comment_image\G
*************************** 1. row ***************************
       Table: community_topic_comment_image
Create Table: CREATE TABLE `community_topic_comment_image` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `post_id` int(11) NOT NULL,
  `file_id` int(11) DEFAULT NULL,
  `number` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id_number_idx` (`id`,`number`),
  KEY `post_id_idx` (`post_id`),
  KEY `file_id_idx` (`file_id`),
  CONSTRAINT `community_topic_comment_image_file_id_file_id` FOREIGN KEY (`file_id`) REFERENCES `file` (`id`) ON DELETE CASCADE,
  CONSTRAINT `community_topic_comment_image_post_id_community_topic_comment_id` FOREIGN KEY (`post_id`) REFERENCES `community_topic_comment` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8

マイグレート時

mysql> SHOW CREATE TABLE community_topic_comment_image\G
*************************** 1. row ***************************
       Table: community_topic_comment_image
Create Table: CREATE TABLE `community_topic_comment_image` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `post_id` int(11) NOT NULL,
  `file_id` int(11) DEFAULT NULL,
  `number` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id_number` (`id`,`number`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

Causes (原因)

マイグレーション側で新規インストール時とテーブル構造を合わせていないため。

Way to fix (修正内容)

  • post_id のインデックスを追加
  • file_id のインデックスを追加
  • post_id の外部キー制約を追加
  • file_id の外部キー制約を追加

文字コードが一致していないが、
文字列が入るカラムが存在しないため対応は行わない。


関連するチケット

関連している opCommunityTopicPlugin - Bug(バグ) #2449: 1.0.2 で追加されたマイグレートスクリプト(リビジョン番号 6)で外部キー制約違反により、マイグレートに失敗することがある Fixed(完了) 2011-09-30

履歴

#1 Rimpei Ogawa13年以上前に更新

  • 3.6 で発生するかYes にセット

#2 Kousuke Ebihara13年以上前に更新

  • 優先度Normal(通常) から High(高め) に変更

#3 Kousuke Ebihara13年以上前に更新

  • [QA]バグ通知済いいえ にセット

#4 Kousuke Ebihara13年以上前に更新

  • [QA]バグ通知済いいえ から はい に変更

#5 Masato Nagasawaほぼ13年前に更新

  • ステータスNew(新規) から Accepted(着手) に変更
  • 担当者Masato Nagasawa にセット

#6 Masato Nagasawaほぼ13年前に更新

修正後のテーブル構造

mysql> SHOW CREATE TABLE community_topic_image\G
*************************** 1. row ***************************
       Table: community_topic_image
Create Table: CREATE TABLE `community_topic_image` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `post_id` int(11) NOT NULL,
  `file_id` int(11) DEFAULT NULL,
  `number` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id_number` (`id`,`number`),
  KEY `post_id_idx` (`post_id`),
  KEY `file_id_idx` (`file_id`),
  CONSTRAINT `community_topic_image_post_id_community_topic_id` FOREIGN KEY (`post_id`) REFERENCES `community_topic` (`id`) ON DELETE CASCADE,
  CONSTRAINT `community_topic_image_file_id_file_id` FOREIGN KEY (`file_id`) REFERENCES `file` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

mysql> SHOW CREATE TABLE community_topic_comment_image\G
*************************** 1. row ***************************
       Table: community_topic_comment_image
Create Table: CREATE TABLE `community_topic_comment_image` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `post_id` int(11) NOT NULL,
  `file_id` int(11) DEFAULT NULL,
  `number` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id_number` (`id`,`number`),
  KEY `post_id_idx` (`post_id`),
  KEY `file_id_idx` (`file_id`),
  CONSTRAINT `community_topic_comment_image_post_id_community_topic_comment_id` FOREIGN KEY (`post_id`) REFERENCES `community_topic_comment` (`id`) ON DELETE CASCADE,
  CONSTRAINT `community_topic_comment_image_file_id_file_id` FOREIGN KEY (`file_id`) REFERENCES `file` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1

mysql> SHOW CREATE TABLE community_event_image\G
*************************** 1. row ***************************
       Table: community_event_image
Create Table: CREATE TABLE `community_event_image` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `post_id` int(11) NOT NULL,
  `file_id` int(11) DEFAULT NULL,
  `number` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id_number` (`id`,`number`),
  KEY `post_id_idx` (`post_id`),
  KEY `file_id_idx` (`file_id`),
  CONSTRAINT `community_event_image_post_id_community_event_id` FOREIGN KEY (`post_id`) REFERENCES `community_event` (`id`) ON DELETE CASCADE,
  CONSTRAINT `community_event_image_file_id_file_id` FOREIGN KEY (`file_id`) REFERENCES `file` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1

mysql> SHOW CREATE TABLE community_event_comment_image\G
*************************** 1. row ***************************
       Table: community_event_comment_image
Create Table: CREATE TABLE `community_event_comment_image` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `post_id` int(11) NOT NULL,
  `file_id` int(11) DEFAULT NULL,
  `number` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id_number` (`id`,`number`),
  KEY `post_id_idx` (`post_id`),
  KEY `file_id_idx` (`file_id`),
  CONSTRAINT `community_event_comment_image_post_id_community_event_comment_id` FOREIGN KEY (`post_id`) REFERENCES `community_event_comment` (`id`) ON DELETE CASCADE,
  CONSTRAINT `community_event_comment_image_file_id_file_id` FOREIGN KEY (`file_id`) REFERENCES `file` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1

#7 Masato Nagasawaほぼ13年前に更新

  • ステータスAccepted(着手) から Pending Review(レビュー待ち) に変更
  • 進捗率0 から 50 に変更

50f5fba09ade39606fb2b5c1e9184a98684262e1 にてコミットしました。

#8 Naoya Tozukaほぼ13年前に更新

  • ステータスPending Review(レビュー待ち) から Pending Testing(テスト待ち) に変更
  • 進捗率50 から 70 に変更

変更点確認しました。OKです。

文字コードが一致していないが、
文字列が入るカラムが存在しないため対応は行わない。

了解です。

#9 Masato Nagasawaほぼ13年前に更新

  • ステータスPending Testing(テスト待ち) から Pending Review(レビュー待ち) に変更
  • 進捗率70 から 50 に変更

リビジョンの更新をしていない問題があったため下記リビジョンで修正しました。
50ce771ed49dc2957e04b87c6130769d1b925a78

レビュー後に申し訳ないのですが、再レビューをお願いします。

#10 Naoya Tozukaほぼ13年前に更新

  • ステータスPending Review(レビュー待ち) から Pending Testing(テスト待ち) に変更
  • 進捗率50 から 70 に変更

修正ありがとうございます。OKです。

#11 Yuma Sakataほぼ13年前に更新

テストOKです。

#12 Yuma Sakataほぼ13年前に更新

  • ステータスPending Testing(テスト待ち) から Fixed(完了) に変更
  • 進捗率70 から 100 に変更

#13 Shingo Yamada12年以上前に更新

  • 360対象RC1 にセット

他の形式にエクスポート: Atom PDF