J’ai effectué manuellement une comparaison des schémas entre un forum Discourse créé il y a plus de 5 ans et une installation neuve. Vous pouvez consulter les différences ici :
https://www.diffchecker.com/lZrp2jxJ
Il s’agit principalement de changements de bigint vers integer et de character varying(255) vers character varying, ainsi que de quelques contraintes not null manquantes, mais il manque également certains index.
Voici les lignes qui les signalent :
Ligne 1646 - manquant :
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 - manquant :
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 - manquant :
Index "public.schema_migrations_pkey"
Column | Type | Key? | Definition
---------+-------------------+------+------------
version | character varying | yes | version
primary key, btree, for table "public.schema_migrations"
5487 - partiellement manquant :
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 - manquant :
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 - manquant :
"index_user_badges_on_user_id" btree (user_id)
Dois-je m’inquiéter de quoi que ce soit ici ? Dois-je ajouter les index manuellement ? D’autres remarques ou quelque chose d’autre vous saute-t-il aux yeux (il est presque 5 heures du matin ici et j’ai du mal à garder les yeux ouverts
)