プロジェクト

全般

プロフィール

QA #331

奈良 裕記 さんが4年以上前に更新

h3. ■現象/要望 

 Redmineのフォーラム(PJメニュー)を、別プロジェクトに移動したい。 
 (プロジェクトの構成も変えたくなる時はありますね) 
 チケット/Wikiは、画面上操作でPJ間移動できるが、フォーラムには移動する機能が準備されていない。 

 http://daragda.herokuapp.com/archives/1994 

 > [要望] フォーラムを別 Project に移したくなったとき、現状は移せないと思うが、移せるようにならないか(チケット、Wikiだと移せる) 

 h3. ■解決策 

 各フォーラム自体は boards テーブルに定義されています。 
 projectの指定は、project_idだけです。 

 移行先projectの設定でフォーラムを有効化しておき、 

 mysql> update boards set project_id=2 where id=1; の様に、 
 project_idを変更するだけで、フォーラムと内容はあっちのPJに引っ越します。 

 <pre> 
 mysql> desc boards; 
 +-----------------+--------------+------+-----+---------+----------------+ 
 | Field             | Type           | Null | Key | Default | Extra            | 
 +-----------------+--------------+------+-----+---------+----------------+ 
 | id                | int(11)        | NO     | PRI | NULL      | auto_increment | 
 | project_id        | int(11)        | NO     | MUL | NULL      |                  | 
 | name              | varchar(255) | NO     |       |           |                  | 
 | description       | varchar(255) | YES    |       | NULL      |                  | 
 | position          | int(11)        | YES    |       | NULL      |                  | 
 | topics_count      | int(11)        | NO     |       | 0         |                  | 
 | messages_count    | int(11)        | NO     |       | 0         |                  | 
 | last_message_id | int(11)        | YES    | MUL | NULL      |                  | 
 | parent_id         | int(11)        | YES    |       | NULL      |                  | 
 +-----------------+--------------+------+-----+---------+----------------+ 
 9 rows in set (0.01 sec) 

 </pre> 

 プロジェクト1に、UnofficlalCrackingというフォーラムが存在したとします。 
 <pre> 

 mysql> select * from boards; 
 +----+------------+--------------------+-------------+----------+--------------+----------------+-----------------+-----------+ 
 | id | project_id | name                 | description | position | topics_count | messages_count | last_message_id | parent_id | 
 +----+------------+--------------------+-------------+----------+--------------+----------------+-----------------+-----------+ 
 |    1 |            1 | UnofficlalCracking | Redmine       |          1 |              1 |                1 |                 1 |        NULL | 
 +----+------------+--------------------+-------------+----------+--------------+----------------+-----------------+-----------+ 
 1 row in set (0.00 sec) 

 </pre> 


 下記操作でproject_id=2のプロジェクトに引っ越します。 

 <pre> 
 mysql> update boards set project_id=2 where id=1; 
 Query OK, 1 row affected (0.12 sec) 
 Rows matched: 1    Changed: 1    Warnings: 0 

 </pre> 

 なお、メッセージ本体は、 messages テーブルになります。 
 <pre> 

 mysql> desc messages; 
 +---------------+--------------+------+-----+---------+----------------+ 
 | Field           | Type           | Null | Key | Default | Extra            | 
 +---------------+--------------+------+-----+---------+----------------+ 
 | id              | int(11)        | NO     | PRI | NULL      | auto_increment | 
 | board_id        | int(11)        | NO     | MUL | NULL      |                  | 
 | parent_id       | int(11)        | YES    | MUL | NULL      |                  | 
 | subject         | varchar(255) | NO     |       |           |                  | 
 | content         | text           | YES    |       | NULL      |                  | 
 | author_id       | int(11)        | YES    | MUL | NULL      |                  | 
 | replies_count | int(11)        | NO     |       | 0         |                  | 
 | last_reply_id | int(11)        | YES    | MUL | NULL      |                  | 
 | created_on      | datetime       | NO     | MUL | NULL      |                  | 
 | updated_on      | datetime       | NO     |       | NULL      |                  | 
 | locked          | tinyint(1)     | YES    |       | 0         |                  | 
 | sticky          | int(11)        | YES    |       | 0         |                  | 
 +---------------+--------------+------+-----+---------+----------------+ 
 12 rows in set (0.00 sec) 

 mysql> select * from messages; 
 +----+----------+-----------+--------------------+-------------------------+-----------+---------------+---------------+---------------------+---------------------+--------+--------+ 
 | id | board_id | parent_id | subject              | content                   | author_id | replies_count | last_reply_id | created_on            | updated_on            | locked | sticky | 
 +----+----------+-----------+--------------------+-------------------------+-----------+---------------+---------------+---------------------+---------------------+--------+--------+ 
 |    1 |          1 |        NULL | めっせーじ1         | 本日はクラッキング日和なり 
         |           1 |               0 |            NULL | 2017-05-15 23:37:37 | 2017-05-15 23:37:37 |        0 |        0 | 
 +----+----------+-----------+--------------------+-------------------------+-----------+---------------+---------------+---------------------+---------------------+--------+--------+ 
 1 row in set (0.00 sec) 

 </pre> 


 h3. ■対応状況 

 DB操作で対応可能 

 h3. ■補足 

 多分、GUI操作で対応可能としたほうが良いと思いますが、 
 そんなに頻繁に行う操作でも無いと思うので。。 
 対応方法が判っていれば良いかなと。 

 もちろん、画面操作のパッチコメントも歓迎します。 


 !https://unofficial-redmine.org/matomo/matomo.php?idsite=1&rec=331! !https://unofficial-redmine.org/matomo/matomo.php?idsite=1&rec=1!

戻る