Closed drcdev-gh closed 2 weeks ago
This seems to fix the issue of starting up:
git diff store/
diff --git a/store/db/mysql/migration/prod/LATEST__SCHEMA.sql b/store/db/mysql/migration/prod/LATEST__SCHEMA.sql
index 3a3fb7d0..7e21eec3 100644
--- a/store/db/mysql/migration/prod/LATEST__SCHEMA.sql
+++ b/store/db/mysql/migration/prod/LATEST__SCHEMA.sql
@@ -1,4 +1,5 @@
-- migration_history
+SET SESSION sql_require_primary_key = 'OFF';
CREATE TABLE `migration_history` (
`version` VARCHAR(256) NOT NULL PRIMARY KEY,
`created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
@@ -130,3 +131,5 @@ CREATE TABLE `reaction` (
`reaction_type` VARCHAR(256) NOT NULL,
UNIQUE(`creator_id`,`content_id`,`reaction_type`)
);
+
+SET SESSION sql_require_primary_key = 'ON';
\ No newline at end of file
But I get into trouble when trying to add a new memo, not sure if it is related though:
2024/07/21 15:30:03 ERROR server error method=/memos.api.v1.MemoService/CreateMemo error="Error 1054 (42S22): Unknown column 'COMMENT' in 'on clause'"
Describe the bug
Multiple tables have the PRIMARY_KEY missing in the mysql driver, which makes memos incompatible with DigitalOceans managed database. This is due to these databases having the variable sql_require_primary_key set to ON for replication purposes (so it's not just limited to DigitalOcean databases, but to all mysql databases that have this setting on).
The "correct" fix would probably be to just give out primary keys to all tables; a workaround might be to use
before creating the tables.
Log excerpt from the docker compose:
Steps to reproduce
The version of Memos you're using.
latest
Screenshots or additional context
No response