2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Redmineのテーブル書き換え

Posted at

はじめに

Redmineのテーブルの書き換え方について紹介します。

変更するテーブル

今回変更するテーブルはjournalsです。このテーブルはRedmineのチケットのコメントなどの情報が記載されています。

テーブルのバックアップ方法

テーブルのバックアップ方法は以下です。テーブルを異なる名前に複製しているだけです。

create table journals_copy like journals;
insert into journals_copy select * from journals;

テーブルの複製方法

文字列置換:プロジェクト単位で文字列を置換

UPDATE journals  SET notes = REPLACE(notes,"<置換対象文字列>", "<置換後の文字列>")

バックアップデータのリストア

リストア方法は以下です。単に複製したテーブルの名前を元の名称に変換するだけです。このときに、テーブル名が重複するといけないので、元のテーブルは消してください。

alter table journals_copy rename to journals;
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?