データベースの整合性を確認する最適な方法は?

あるフォーラムのユーザー、トピック、投稿を別のフォーラムにマージしたいと考えています。フォーラムのリストアは開発環境では問題なく行えるのですが、マージを試みると PG::ForeignKeyViolation エラーが発生します(現在は新規インストールに対して実行中)。そこで、データベースの整合性をチェックできる Discourse ツールがあるかどうか知りたいのですが、もしそのようなツールがない場合、他のヒントやアイデアはありますか?

(データベースに関する話題がいくつかあることから、もしそのようなツールが現在存在しない場合、DC チームはこのようなツールの開発を検討する価値があると考えているのでしょうか?)

5 年以上前に立ち上げられた Discourse フォーラムのスキーマと、新規インストールのスキーマを手動で比較しました。その違いは以下のページでご確認いただけます:

https://www.diffchecker.com/lZrp2jxJ

主に bigint から integer へ、character varying(255) から character varying への変更や、いくつかの not null 制約の欠落が見られますが、いくつかのインデックスも不足しています。

それらを指摘する行は以下の通りです:

行 1646 - 欠落:

  Index "public.index_badges_on_badge_type_id"
 Column |          Type          | Key? | Definition 		    Column     |  Type   | Key? |  Definition   
--------+------------------------+------+------------		---------------+---------+------+---------------
 name   | character varying(255) | yes  | name		 badge_type_id | integer | yes  | badge_type_id
btree, for table "public.badges"

行 3301 - 欠落:

	Index "public.index_user_badges_on_user_id"
 Column  |  Type   | Key? | Definition 
---------+---------+------+------------
 user_id | integer | yes  | user_id
btree, for table "public.user_badges"

行 4639 - 欠落:

	      Index "public.schema_migrations_pkey"
 Column  |       Type        | Key? | Definition 
---------+-------------------+------+------------
 version | character varying | yes  | version
primary key, btree, for table "public.schema_migrations"

行 5487 - 部分的に欠落:

                                       Table "public.topic_search_data"
   Column    |          Type          | Collation | Nullable | Default 		   Column    |       Type        | Collation | Nullable |                       Default                       
-------------+------------------------+-----------+----------+---------		-------------+-------------------+-----------+----------+-----------------------------------------------------
 topic_id    | integer                |           | not null | 		 topic_id    | integer           |           | not null | nextval('topic_search_data_topic_id_seq'::regclass)
 raw_data    | text                   |           |          | 		 raw_data    | text              |           |          | 
 locale      | character varying(255) |           | not null | 		 locale      | character varying |           | not null | 
 search_data | tsvector               |           |          | 		 search_data | tsvector          |           |          | 
 version     | integer                |           |          | 0		 version     | integer           |           |          | 0

行 5506 - 欠落:

           Sequence "public.topic_search_data_topic_id_seq"
  Type   | Start | Minimum |  Maximum   | Increment | Cycles? | Cache 
---------+-------+---------+------------+-----------+---------+-------
 integer |     1 |       1 | 2147483647 |         1 | no      |     1
Owned by: public.topic_search_data.topic_id

行 6044 - 欠落:

    "index_user_badges_on_user_id" btree (user_id)

ここですぐに懸念すべき点はありますか?インデックスを手動で追加すべきでしょうか?他にも何か気になる点や、他の人にも目につくものはありますか?(今は午前 5 時近くで、目が覚めていられるのがやっとです :see_no_evil: