Я вручную сравнил схемы форума Discourse, работающего более 5 лет, и свежей установки; различия можно увидеть здесь:
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 утра, и мне с трудом удаётся держать глаза открытыми
)