Hi,
I recently migrated from OC to NC. Announcement center worked there. I can see the old announcements.
Tried removing and installing announcement center, even setting version to 0.0.0 and run ‘occ update’, but the error is still there.
Exception when sending announcement.
From the logs:
DbalException
An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘allow_comments’ in ‘field list’
Any clue, which table needs the column?
what about try running
sudo -u www-data php occ db:add-missing-columns
from your nextcloud installation directory?
The command simply prints: ‘Done.’, but the error is still present.
ummmm… are there any setup-messages left in your admin account that needs to be solved?
No. Everything looks okay. Except /core/routes.php, where I added code to fix the heartbeat problem.
Found feat: add commands for exporting current and expected database schema by icewind1991 · Pull Request #46194 · nextcloud/server · GitHub . That might be useful, but I have no clue, how to use this.
jtr
July 5, 2024, 3:10pm
6
1 Like
Thanks for the hint. I added that field and now it’s working. Shouldn’t have the command occ db:add-missing-columns added the missing field?
Question:
MySQL/MariaDB or PostgreSQL?
Could you please post the output from this SQL-Query:
This is for MySQL/MariaDB, if you are using PostgreSQL, it is slightly different:
SHOW COLUMNS FROM oc_announcements;
It SHOULD look like this example:
MariaDB [nextcloud]> SHOW COLUMNS FROM oc_announcements;
+----------------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------------+--------------+------+-----+---------+----------------+
| announcement_id | int(11) | NO | PRI | NULL | auto_increment |
| announcement_time | int(11) | NO | | 0 | |
| announcement_user | varchar(64) | NO | | NULL | |
| announcement_subject | varchar(512) | NO | | NULL | |
| announcement_message | longtext | YES | | NULL | |
| allow_comments | smallint(6) | YES | | 1 | |
| announcement_plain_message | longtext | YES | | NULL | |
+----------------------------+--------------+------+-----+---------+----------------+
7 rows in set (0,002 sec)
If in your database the ‘allow_comments
’ column is missing, then you should add it with this Query:
ALTER TABLE oc_announcements ADD COLUMN allow_comments smallint(6) DEFAULT 1;
If you are on a debian/ubuntu box and don’t know how to get an SQL console, use → nc-sql ←
I hope this was helpfull.
Much and good luck,
ernolf
2 Likes
jtr
July 5, 2024, 3:35pm
9
Based on a quick glance at the code that handles that, only if the particular app supports registering missing database columns. I don’t know if announcementcenter
does.
1 Like