I’ve manually done a diff on schemas from a Discourse forum that was started over 5 years ago and a fresh install, you can see the differences here:
https://www.diffchecker.com/lZrp2jxJ
Mostly changes of bigint to integer and character varying(255) to character varying and a few not nulls missing, but there are some indexes missing too.
Here are the lines that point them out:
Line 1646 - missing:
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 - missing:
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 - missing:
Index "public.schema_migrations_pkey"
Column | Type | Key? | Definition
---------+-------------------+------+------------
version | character varying | yes | version
primary key, btree, for table "public.schema_migrations"
5487 - partly missing:
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 - missing:
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 - missing:
"index_user_badges_on_user_id" btree (user_id)
Should I be concerned about anything here? Should I add the indexes manually? Any other thoughts or anything else stand out to anyone (it’s nearly 5am here and I’m struggling to keep my eyes open
)