usememos / memos

An open-source, lightweight note-taking solution. The pain-less way to create your meaningful notes. Your Notes, Your Way.
https://usememos.com
MIT License
34.58k stars 2.49k forks source link

[postgresql] failed to migrate error="strconv.Atoi: parsing "00_reaction.sql": invalid syntax #4093

Closed bohdan-shulha closed 3 weeks ago

bohdan-shulha commented 3 weeks ago

Describe the bug

Hey team,

I've been trying to set up Memos with Docker, but it seems that there's something wrong with the migrations in the stable docker image.

Whenever I run memos with postgresql, I get the following error:

2024-11-03 13:27:21 2024/11/03 12:27:21 ERROR failed to migrate error="strconv.Atoi: parsing \"00_reaction.sql\": invalid syntax\nfailed to convert patch version to int: 00_reaction.sql\ngithub.com/usememos/memos/store.(*Store).getSchemaVersionOfMigrateScript\n\tgithub.com/usememos/memos/store/migrator.go:233\ngithub.com/usememos/memos/store.(*Store).normalizedMigrationHistoryList\n\tgithub.com/usememos/memos/store/migrator.go:272\ngithub.com/usememos/memos/store.(*Store).preMigrate\n\tgithub.com/usememos/memos/store/migrator.go:151\ngithub.com/usememos/memos/store.(*Store).Migrate\n\tgithub.com/usememos/memos/store/migrator.go:37\nmain.init.func1\n\t./main.go:61\ngithub.com/spf13/cobra.(*Command).execute\n\tgithub.com/spf13/cobra@v1.8.1/command.go:989\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tgithub.com/spf13/cobra@v1.8.1/command.go:1117\ngithub.com/spf13/cobra.(*Command).Execute\n\tgithub.com/spf13/cobra@v1.8.1/command.go:1041\nmain.main\n\t./main.go:171\nruntime.main\n\truntime/proc.go:271\nruntime.goexit\n\truntime/asm_arm64.s:1222\nfailed to get schema version of migrate script\ngithub.com/usememos/memos/store.(*Store).normalizedMigrationHistoryList\n\tgithub.com/usememos/memos/store/migrator.go:274\ngithub.com/usememos/memos/store.(*Store).preMigrate\n\tgithub.com/usememos/memos/store/migrator.go:151\ngithub.com/usememos/memos/store.(*Store).Migrate\n\tgithub.com/usememos/memos/store/migrator.go:37\nmain.init.func1\n\t./main.go:61\ngithub.com/spf13/cobra.(*Command).execute\n\tgithub.com/spf13/cobra@v1.8.1/command.go:989\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tgithub.com/spf13/cobra@v1.8.1/command.go:1117\ngithub.com/spf13/cobra.(*Command).Execute\n\tgithub.com/spf13/cobra@v1.8.1/command.go:1041\nmain.main\n\t./main.go:171\nruntime.main\n\truntime/proc.go:271\nruntime.goexit\n\truntime/asm_arm64.s:1222\nfailed to normalize migration history list\ngithub.com/usememos/memos/store.(*Store).preMigrate\n\tgithub.com/usememos/memos/store/migrator.go:152\ngithub.com/usememos/memos/store.(*Store).Migrate\n\tgithub.com/usememos/memos/store/migrator.go:37\nmain.init.func1\n\t./main.go:61\ngithub.com/spf13/cobra.(*Command).execute\n\tgithub.com/spf13/cobra@v1.8.1/command.go:989\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tgithub.com/spf13/cobra@v1.8.1/command.go:1117\ngithub.com/spf13/cobra.(*Command).Execute\n\tgithub.com/spf13/cobra@v1.8.1/command.go:1041\nmain.main\n\t./main.go:171\nruntime.main\n\truntime/proc.go:271\nruntime.goexit\n\truntime/asm_arm64.s:1222\nfailed to pre-migrate\ngithub.com/usememos/memos/store.(*Store).Migrate\n\tgithub.com/usememos/memos/store/migrator.go:38\nmain.init.func1\n\t./main.go:61\ngithub.com/spf13/cobra.(*Command).execute\n\tgithub.com/spf13/cobra@v1.8.1/command.go:989\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tgithub.com/spf13/cobra@v1.8.1/command.go:1117\ngithub.com/spf13/cobra.(*Command).Execute\n\tgithub.com/spf13/cobra@v1.8.1/command.go:1041\nmain.main\n\t./main.go:171\nruntime.main\n\truntime/proc.go:271\nruntime.goexit\n\truntime/asm_arm64.s:1222"

Steps to reproduce

  1. Set up Postgresql
  2. Use docker to start memos

The version of Memos you're using.

stable

Screenshots or additional context

image
RoccoSmit commented 3 weeks ago

Duplicate of https://github.com/usememos/memos/issues/3885 See the following pr for more info on how to resolve this https://github.com/usememos/memos/pull/3873

boojack commented 3 weeks ago

@bohdan-shulha And if you'd like to use PostgreSQL, you can try the latest version v0.23.0-rc.0.

bohdan-shulha commented 3 weeks ago

latest worked for me, thanks!