Unable to enable File Sharing after migration from SQLite to Postgres

Note: I opened a bug report for this (Unable to enable File Sharing after migration from SQLite to Postgres · Issue #25414 · nextcloud/server · GitHub), please see the bug report for complete details.

After migrating from SQLite to Postgres, I cannot re-enable file sharing anymore. Whenever I try, I get the following issue:

The message in the screenshot in the link is

An exception occurred while executing ' SELECT "remote", "share_token", "password", "mountpoint", "owner" FROM "oc_share_external" WHERE "user" = ? AND "accepted" = ? ' with params ["wojtek", 1]: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "oc_share_external" does not exist LINE 3: FROM "oc_share_external" ^

Is there something that I can do to have the right structure of the DB (which I believe is the issue)?

I managed to find a solution, but this is quite miraculous

~ ➤ docker exec --user www-data nextcloud php occ app:install files_sharing
files_sharing already installed
~ ➤ docker exec --user www-data nextcloud php occ app:update files_sharing
~ ➤ docker exec --user www-data nextcloud php occ app:enable files_sharing
files_sharing 1.12.2 enabled