Run migrations for fresh installs
as per https://github.com/usememos/memos/issues/4060 the 00__reactions.sql migration for v0.23 does not run when you start with a fresh install
This PR covers 2 changes
Change 1:
GetCurrentSchemaVersion get the current version (v0.23) and passes it into the migration logic. getSchemaVersionOfMigrateScript then increases the minor version so the schema version is v0.23.1 which does not match up with the schema set in the version.go file.
Change 2:
For fresh installs the migrations logic does not currently run as the logic looks to see if schemaVersion > latestMigrationHistoryVersion but these 2 are set to be equal in the preMigrate logic if no previous migrations found which would be the case for fresh installs.
Not sure what is causing checks to fail. Will revisit tomorrow
@RoccoSmit Expectedly, the newly started instance should not execute any migrations. So I think what's needed here is to handle the default reactions value for memo setting.
Reference: https://github.com/usememos/memos/blob/main/store/workspace_setting.go#L157
Makes sense. I wasn't sure if the LASTEST.sql files were for creating the initial db structure and the migrations were to add data to the tables.
If migrations are not run on the first install, would it make sense to add the insertion of the initial reactions to the LATEST.sql files? If not, I'll add 👍 as a default reaction value in workspace_setting.go if no value is set during save and load.
I'll add 👍 as a default reaction value in workspace_setting.go if no value is set during save and load.
SGTM