Congrats!
I hope for you that you have a backup of your database.
Unfortunately I have to disappoint you, it doesn’t work that way. The oc_mounts
table is one of the central database tables without which it is impossible to determine how everything is connected to the file system.
The command occ db:add-missing-indicies
won’t do anything, it’s intended for completely different tasks.
In short: either database dump (backup) or new installation
But since you are obviously quite adventurous and probably want to try it yourself, here is some information about the relevant table (from one of my virtual machines):
MariaDB [nextcloud]> SHOW COLUMNS FROM oc_mounts;
+----------------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+---------------+------+-----+---------+----------------+
| id | bigint(20) | NO | PRI | NULL | auto_increment |
| storage_id | bigint(20) | NO | MUL | NULL | |
| root_id | bigint(20) | NO | MUL | NULL | |
| user_id | varchar(64) | NO | MUL | NULL | |
| mount_point | varchar(4000) | NO | | NULL | |
| mount_id | bigint(20) | YES | MUL | NULL | |
| mount_provider_class | varchar(128) | YES | MUL | NULL | |
+----------------------+---------------+------+-----+---------+----------------+
7 rows in set (0,001 sec)
MariaDB [nextcloud]> SHOW INDEX FROM oc_mounts;
+-----------+------------+-----------------------------+--------------+----------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | Ignored |
+-----------+------------+-----------------------------+--------------+----------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+
| oc_mounts | 0 | PRIMARY | 1 | id | A | 0 | NULL | NULL | | BTREE | | | NO |
| oc_mounts | 1 | mounts_storage_index | 1 | storage_id | A | 0 | NULL | NULL | | BTREE | | | NO |
| oc_mounts | 1 | mounts_root_index | 1 | root_id | A | 0 | NULL | NULL | | BTREE | | | NO |
| oc_mounts | 1 | mounts_mount_id_index | 1 | mount_id | A | 0 | NULL | NULL | YES | BTREE | | | NO |
| oc_mounts | 1 | mounts_class_index | 1 | mount_provider_class | A | 0 | NULL | NULL | YES | BTREE | | | NO |
| oc_mounts | 1 | mount_user_storage | 1 | storage_id | A | 0 | NULL | NULL | | BTREE | | | NO |
| oc_mounts | 1 | mount_user_storage | 2 | user_id | A | 0 | NULL | NULL | | BTREE | | | NO |
| oc_mounts | 1 | mounts_user_root_path_index | 1 | user_id | A | 0 | NULL | NULL | | BTREE | | | NO |
| oc_mounts | 1 | mounts_user_root_path_index | 2 | root_id | A | 0 | NULL | NULL | | BTREE | | | NO |
| oc_mounts | 1 | mounts_user_root_path_index | 3 | mount_point | A | 0 | 128 | NULL | | BTREE | | | NO |
+-----------+------------+-----------------------------+--------------+----------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+
10 rows in set (0,000 sec)
So in order to create a table with exactly the same properties, you have to use the following SQL statement:
CREATE TABLE oc_mounts (
id bigint(20) NOT NULL AUTO_INCREMENT,
storage_id bigint(20) NOT NULL,
root_id bigint(20) NOT NULL,
user_id varchar(64) NOT NULL,
mount_point varchar(4000) NOT NULL,
mount_id bigint(20),
mount_provider_class varchar(128),
PRIMARY KEY (id),
KEY mounts_storage_index (storage_id),
KEY mounts_root_index (root_id),
KEY mount_user_storage (storage_id, user_id),
KEY mounts_mount_id_index (mount_id),
KEY mounts_class_index (mount_provider_class),
KEY mounts_user_root_path_index (user_id, root_id, mount_point(128))
);
Here the result, creating a table “new_oc_mounts”:
MariaDB [nextcloud]> CREATE TABLE new_oc_mounts (
-> id bigint(20) NOT NULL AUTO_INCREMENT,
-> storage_id bigint(20) NOT NULL,
-> root_id bigint(20) NOT NULL,
-> user_id varchar(64) NOT NULL,
-> mount_point varchar(4000) NOT NULL,
-> mount_id bigint(20),
-> mount_provider_class varchar(128),
-> PRIMARY KEY (id),
-> KEY mounts_storage_index (storage_id),
-> KEY mounts_root_index (root_id),
-> KEY mount_user_storage (storage_id, user_id),
-> KEY mounts_mount_id_index (mount_id),
-> KEY mounts_class_index (mount_provider_class),
-> KEY mounts_user_root_path_index (user_id, root_id, mount_point(128))
-> );
Query OK, 0 rows affected (0,141 sec)
MariaDB [nextcloud]> SHOW COLUMNS FROM new_oc_mounts;
+----------------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+---------------+------+-----+---------+----------------+
| id | bigint(20) | NO | PRI | NULL | auto_increment |
| storage_id | bigint(20) | NO | MUL | NULL | |
| root_id | bigint(20) | NO | MUL | NULL | |
| user_id | varchar(64) | NO | MUL | NULL | |
| mount_point | varchar(4000) | NO | | NULL | |
| mount_id | bigint(20) | YES | MUL | NULL | |
| mount_provider_class | varchar(128) | YES | MUL | NULL | |
+----------------------+---------------+------+-----+---------+----------------+
7 rows in set (0,001 sec)
MariaDB [nextcloud]> SHOW INDEX FROM new_oc_mounts;
+---------------+------------+-----------------------------+--------------+----------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | Ignored |
+---------------+------------+-----------------------------+--------------+----------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+
| new_oc_mounts | 0 | PRIMARY | 1 | id | A | 0 | NULL | NULL | | BTREE | | | NO |
| new_oc_mounts | 1 | mounts_storage_index | 1 | storage_id | A | 0 | NULL | NULL | | BTREE | | | NO |
| new_oc_mounts | 1 | mounts_root_index | 1 | root_id | A | 0 | NULL | NULL | | BTREE | | | NO |
| new_oc_mounts | 1 | mount_user_storage | 1 | storage_id | A | 0 | NULL | NULL | | BTREE | | | NO |
| new_oc_mounts | 1 | mount_user_storage | 2 | user_id | A | 0 | NULL | NULL | | BTREE | | | NO |
| new_oc_mounts | 1 | mounts_mount_id_index | 1 | mount_id | A | 0 | NULL | NULL | YES | BTREE | | | NO |
| new_oc_mounts | 1 | mounts_class_index | 1 | mount_provider_class | A | 0 | NULL | NULL | YES | BTREE | | | NO |
| new_oc_mounts | 1 | mounts_user_root_path_index | 1 | user_id | A | 0 | NULL | NULL | | BTREE | | | NO |
| new_oc_mounts | 1 | mounts_user_root_path_index | 2 | root_id | A | 0 | NULL | NULL | | BTREE | | | NO |
| new_oc_mounts | 1 | mounts_user_root_path_index | 3 | mount_point | A | 0 | 128 | NULL | | BTREE | | | NO |
+---------------+------------+-----------------------------+--------------+----------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+
10 rows in set (0,001 sec)
As you can easily see, I created a table with the statement with exactly the same properties.
Now it only has to be populated with the correct data. THAT is only possible with a backup.
much luck!